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

Get file content has an error when I want to splitting csv file: "Unable to process template language expressions in action"

Hi!

 

I would like to create a flow which is waiting for a file created in a Sharepoint folder ("When a file is created in a folder" trigger).

jsz930801_0-1657092159292.png

 

I always copy .csv files into this folder which have to be processed. The trigger is followed by "Get file content" (File identifier is "x-ms-file-id") which is maybe the source of the problem, because the "Compose-split by new line" action recognizes type Object from the output of "Get file content" despite the csv file contains comma separeted values (there's no null value).

 

By the way I created this flow by this tutorial: https://www.c-sharpcorner.com/article/parse-csv-file-using-power-automate/

In this solution the path of the exact file is defined manually so it's not right for me because the flow should process the csv file automatically (when I copy it into the trigger's folder).

 

Could someone help me in this flow?

1 ACCEPTED SOLUTION

Accepted Solutions
annajhaveri
Community Champion
Community Champion

@jsz930801 you are using SharePoint Get File Content action which returns the data in Base64 encoding not the text data. So you need to following expression to convert it to a string, use following expression in the compose action which is failing for you:

split(base64ToString(outputs('Get_file_content')?['body']?['$content']), decodeUriComponent('%0D%0A'))

 

thanks to @Paulie78  , i got understanding from his video about parsing CSV file https://www.youtube.com/watch?v=sXdeg_6Lr3o

 

 

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
annajhaveri
Community Champion
Community Champion

@jsz930801 can you please share the expression that you have used in the Compose-split by new line action?

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

This is the expression of "Compose-split by new line action":
split(outputs('Get_file_content')?['body'],outputs('Compose-new_line'))
 
The "Compose-new line" contains an empty line to denote a new one.
annajhaveri
Community Champion
Community Champion

@jsz930801 you are using SharePoint Get File Content action which returns the data in Base64 encoding not the text data. So you need to following expression to convert it to a string, use following expression in the compose action which is failing for you:

split(base64ToString(outputs('Get_file_content')?['body']?['$content']), decodeUriComponent('%0D%0A'))

 

thanks to @Paulie78  , i got understanding from his video about parsing CSV file https://www.youtube.com/watch?v=sXdeg_6Lr3o

 

 

 

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.

Thank you so much!

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,712)