cloudy
cloudy

Reputation: 123

Logic App - create table from CSV in email

I am trying to send nice email with table (content from CSV file), similar here: Email test page

The biggest issue is formatting the table in email. In Logic App in step "Send an Email" in Body is FILE CONTENT (here screenshot: Logic App Send an Email screenshot. Table is not formatted and looks like:

test
SEP=, "NAME","SKU","TYPE","KIND","PLAN","TAGS","ALIASES","LOCATION","PROPERTIES","RESOURCE GROUP","SUBSCRIPTION","MANAGEDBY","IDENTITY","ZONES","TENANTID","APIVERSION" "VirtualMachine","null","microsoft.security/securitystatusessummaries","","null","null","{}","","{""resourceHealthSummryPerCategory"":[{""category"":""Compute"",""healthy"":null,""medium"":null,""high"":1,""none"":null,""low"":null},{""category"":""Networking"",""healthy"":null,""medium"":null,""high"":1,""none"":null,""low"":null}],""policyAssessmentsSummaries"":[{""policyDefinitionId"":null,""assessmentKey"":""12018f4f-3d10-999b-e4c4-86ec25be08a1"",""category"":""Compute"",""policyName"":""Virtual machines should be migrated to new Azure Resource Manager resources"",""healthy"":1,""medium"":null,""high"":null,""none"":null,""low"":null},{""policyDefinitionId"":null,""assessmentKey"":""3bcd234d-c9csdcs7-c2a2-89e0-c01f41dfv9c1a8a"",""category"":""Compute"",""policyName"":""Endpoint protection health issues should be resolved on your machines"",""healthy"":1,""medium"":null,""high"":null,""none"":null,""low"":null},{""policyDefinitionId"":null,""assessmentKey"":""8e2b96ff-3dedfvfd2-289b-b5c1-3b9921a34dfv41e"",""category"":""Compute"",""policyName"":""Monitoring agent health issues should be resolved on your machines"",""healthy"":1,""medium"":null,""high"":null,""none"":null,""low"":null},{""policyDefinitionId"":null,""assessmentKey"":""83f577bd-adfv1b6-b7e1-0891-12ca19d1dfve6df"",""category"":""Compute"",""policyName"":""Install endpoint protection solution on virtual machines"",""healthy"":1,""medium"":null,""high"":null,""none"":null,""low"":null},{"" 

I would like to get table instead ugly string.

Do you have any idea how to achieve that ?

Upvotes: 1

Views: 1649

Answers (1)

Hury Shen
Hury Shen

Reputation: 15734

For this requirement, I provide a sample below for your reference.

1. I upload a csv file to azure blob storage to simulate your situation.

enter image description here

2. Then search the action "Parse CSV" in you logic app.

enter image description here

3. It will ask you to input "API Key", you need to go to this page first --> click "Start free trial", register an account and create a new API Key. enter image description here enter image description here Copy the secret and paste it to your logic, it will allow you to connect Plumsail.

4. Input the "File Content" and the headers into the box, we can also add a new parameter "Skip first line" and set it "Yes"(this parameter will skip the header line and avoid two lines header in the expect table). enter image description here

5. Now we need to use "Create HTML table" action to create table by the data from "Parse CSV". enter image description here

6. After that, we can send the email with the "Output" data from "Create HTML table" action. enter image description here

7. The email I receive looks like below:

enter image description here

Upvotes: 0

Related Questions