cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DavidNoble
New Member

Parsing a CSV

Hi everyone,


New to Power Automate, and attempting what (should) be simple parsing of a CSV!

The flow that I have uses a Sharepoint Connector which appears to be reading the file correctly. I've included a screenshot of this running with sensitive information removed at the bottom of this post.

I am following Manuel T. Gomes tutorial: https://manueltgomes.com/microsoft/powerautomate/how-to-parse-csv-file/

I have created an array variable, but when I try and split the CSV into the array by line using the syntax: split(outputs('Get_file_content')?['body'],'') in a Set Variable action action I get error:

'The template language function 'split' expects its first parameter to be of type string. The provided value is of type 'Object'

In a separate tutorial there is a bug documented when splitting using the new line chacter: https://dynamicscitizendeveloper.com/2019/06/06/microsoft-flow-csv-integration-with-dynamics-365/

According to this blog my expression should be: "@split(outputs('Get_file_content'),'\r\n')"

....however when I try this I get the same error again.

Is there something fundamental I don't understand yet about how to 'get at' the contents of the file I've read in using the Sharepoint connector? I notice the examples tend to use the OneDrive connector but I'm assuming I should be able to use the sharepoint connector as well?

 

SharePoint Connector.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-alzhan-msft
Community Support
Community Support

Hi @DavidNoble ,

 

For the error message that the split function expect the first parameter to a string, you could convert the object to string with expression String() .

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-alzhan-msft
Community Support
Community Support

Hi @DavidNoble ,

 

For the error message that the split function expect the first parameter to a string, you could convert the object to string with expression String() .

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Many thanks that solved the problem!

 

So for anyone else wanting to get the text from a file read in via a Sharepoint connector in my example above; the full syntax is:

 

string(outputs('Get_file_content')?['body'])

 

Hopefully that helps someone else, as it's not obvious when it your first day using Power Automate!

Your syntax sample was great. Just one small change I made was to make sure the 'Get_File_content' is a valid Dynamic Content (an not manually typed from your example above).

 

365-Assist_0-1613078108343.png

 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,400)