cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
snamuth
Level: Powered On

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
Community Support Team
Community Support Team

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

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

snamuth
Level: Powered On

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

@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"
}
]
}
]

 

Super User
Super User

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

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,134)