cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

read csv file content and pass into json array to post via HTTP Post Action

I am trying to read the contents of a csv file that looks like the example below, I need to map the headers to match the column names in the database, and then pass the values as json in the body of an HTTP Post action to update a database using an API.

 

id, firstname, lastname, email, createdate

1, joe, smoe, joesmoe@joe.com,7/31/2018

2, jill, smoe, jillsmoe@jill.com, 7/31/2018

 

Any help with customizing an advanced flow would be greaty appreciated. 

3 REPLIES 3
Highlighted
Community Support
Community Support

Hi @snamuth,

 

I afraid that there is no any way to achieve your needs to read the contents of a csv file,map the headers to match the column names in the database, and then pass the values as json in the body of an HTTP Post action to update a database using an API in microsoft flow currently.

 

If you would like this feature to read the contents of a csv file to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

Best regards,

Alice

Highlighted

@v-yuazh-msft I think getting the file content is already available in Flow. When picking up a file from an sFTP, I can use the advanced options in the sFTP trigger to get the file content, and I can probably use the data operation for Select to rename the headers in the content to match what I need. The problem I am having is converting the content to JSON. For example, the csv content looks like this.

CSV Content

id, firstname, lastname, email, createdate
1, joe, smoe, joesmoe@joe.com,7/31/2018
2, jill, smoe, jillsmoe@jill.com, 7/31/2018

 

I need the output that I pass to the API to look like this

[
  {
    "vid": "1",
    "properties": [
      {
        "property": "firstname",
        "value": "joe"
      },
      {
        "property": "lastname",
        "value": "smoe"
      },
{
"property": "email",
"value": "joesmoe@joe.com"
},
{
"property": "createdate",
"value": "7/31/2018"
}
]
}
]

 

Highlighted

You can use Parse CSV action from Plumsail Documents connector. It allows you to convert CSV into an array and variables for each column. Please read this article demonstrating how it works.

 

The result of the parse action is internally JSON. You can submit this data to your POST action.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (8,682)