Skip to main content
Community site session details

Community site session details

Session Id : xo9sd6qmdUfCyogZhL80PK
Power Automate - Building Flows
Answered

Read CSV file from attachment in Outlook

Like (0) ShareShare
ReportReport
Posted on 2 Nov 2023 16:12:44 by

Hello all,

 

I'm working on a flow that is triggered when a new email arrives in a shared mailbox (V2). The email contains a CSV file that I need to parse to JSON Array, but I cannot seem to connect the dynamic content from the CSV file to my flow.

 

For testing purposes, I pasted what my CSV file would look like in the second step of my flow called 'Compose CSV'. In the further steps, I've followed up on the output from Compose CSV to convert the csv data into Array.

 

I got this to work, but I'm stuck now that I want to use the dynamic content from the e-mail. I've tried to replace the expression: @{split(outputs('Compose_(CSV)'),outputs('NewLine'))} by referring to the trigger output: @{split(outputs(triggerOutputs()?['body/attachments']),outputs('NewLine'))} but I get an InvalidTemplate 

 

Which dynamic content do I need to use to get my flow to work from emailed csv data? And is it correct that I can change the input of the split expression for this to work? Or do I need to change my flow? See picture for my current flow. Let me know if I need to clarify something. I am quite new to building these kinds of flows so any help would be appreciated.

  • Verified answer
    v-yetonggu-msft Profile Picture
    on 03 Nov 2023 at 01:38:44
    Re: Read CSV file from attachment in Outlook

    Hi @Anonymous ,

    Please check this link:Power Automate: How to parse a CSV File to create a JSON array (tachytelic.net)

    I did a test for your reference.

    In my scenario:

    vyetonggumsft_2-1698975176021.png

    vyetonggumsft_4-1698975366603.png

    vyetonggumsft_0-1698990581649.png

     

     

    base64ToString(outputs('Get_Attachment_(V2)')?['body/contentBytes'])
    split(outputs('Compose'), decodeUriComponent('%0D%0A'))
    skip(outputs('splitNewLine'),1)
    split(item(), ',')
    outputs('splitByComma')?[0]
    outputs('splitByComma')?[1]

     

     

    My CSV File Content:

    vyetonggumsft_1-1698990699131.png

    Best Regards,

    Sunshine Gu

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete