Skip to main content

Notifications

Community site session details

Community site session details

Session Id : aVLZ2CtbJ7veowr20N7N1n
Power Automate - Building Flows
Answered

In MS Flow is it possible to convert CSV into Excel

Like (0) ShareShare
ReportReport
Posted on 21 Apr 2022 04:44:34 by 2,666 Super User 2025 Season 1

Hi All,

I have Some scenario i need to convert csv file into Excel file, without using premium connectors like Encodian and Plumsail Documents connector.

If anyone knows better solution let me know.

 

Thanks,

Ahammad Riyaz

  • takolota1 Profile Picture
    4,859 Super User 2025 Season 1 on 19 Oct 2022 at 21:14:12
    Re: In MS Flow is it possible to convert CSV into Excel

    You can now try automatically converting most CSVs to a new Excel table with the same column names as the CSV headers with this template: 

    https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/CSV-To-New-Excel-Table/m-p/1826096#M964

  • Riyaz_riz11 Profile Picture
    2,666 Super User 2025 Season 1 on 22 Apr 2022 at 04:40:30
    Re: In MS Flow is it possible to convert CSV into Excel

    Yes, for me column name will be constant.

  • Paulie78 Profile Picture
    8,407 Super User 2025 Season 1 on 21 Apr 2022 at 17:11:47
    Re: In MS Flow is it possible to convert CSV into Excel

    Hi @Ahammad_Riyaz great to hear you were able to use my blog post to help you.

     

    You might also want to check this one out to make your flow more efficient when putting the data into Excel:

    https://www.tachytelic.net/2021/08/power-automate-export-to-excel/ 

  • Rhiassuring Profile Picture
    8,688 Super User 2025 Season 1 on 21 Apr 2022 at 16:48:27
    Re: In MS Flow is it possible to convert CSV into Excel

    @Ahammad_Riyaz  That solution will only work for you if you have the same column titles in your CSV every time. Is that the case? 

  • Verified answer
    Riyaz_riz11 Profile Picture
    2,666 Super User 2025 Season 1 on 21 Apr 2022 at 12:21:34
    Re: In MS Flow is it possible to convert CSV into Excel

    Hi All,

    Thanks for all your responses.

    I got the solution from this link, https://www.tachytelic.net/2021/02/power-automate-parse-csv/

    Not much steps to follow.

  • Rhiassuring Profile Picture
    8,688 Super User 2025 Season 1 on 21 Apr 2022 at 07:49:35
    Re: In MS Flow is it possible to convert CSV into Excel

    Hi @Ahammad_Riyaz 

    Yes, this is achievable - I spent way too long testing this out on my side, haha.  I am tired, so this is going to be a quick screenshot dump - with probably a lot of inelegance, as I was just going for function!

    My demo CSV...

    Rhiassuring_0-1650517025713.png

    Rhiassuring_1-1650517036193.png

     

    To start, we get the File Content from your CSV file.
    Then, we start processing the File Content. I used these actions:

     

    Rhiassuring_1-1650526810847.png

     

     

    Split by NewLine: I'm replacing the newlines with a dollar sign, and then splitting on them.

    split(replace(outputs('Get_file_content_using_path')?['body'],decodeUriComponent('%0D%0A'),'$'),'$')

    Filter array - remove nulls: just what it sounds like. Looking at Compose - Split by NewLine's outputs:
    @equals(empty(item()), false)

    Compose - get array header values and split on comma
    split(first(body('Filter_array_-_remove_nulls')),',')

    Compose - array without the header values
    skip(body('Filter_array_-_remove_nulls'),1)
     
    Now that we have that going, time to set up the Excel doc.
     
    Create an Excel file, create a Table (using a variable so you have the name, and setting the range to A1), then we use our previous Compose to get the column names, and drop them into the field.

    (Note: in my test I did it in a dumb way, so no screenshots, but what you'd do here is just turn your "Compose - get array header values and split on comma" into a string variable and plop them in there.

    Now, from here, it's pandemonium

    In an "Apply to each", I am using the Outputs from "Compose - array without headers..". 

    First, I split them by comma so I have them individually. 

    Then, in another "Apply to Each" focused on the output from that split, I use the Append to String to build out my values. I set it to 
    "outputs('Compose_-_Get_array_header_values_and_split_on_comma')[variables('intIncrement')]": "outputs('Compose_-_Clean_out_the_other_linebreak')" and then I increase my intIncrement by 1. I use that to ensure it goes into the right column.
     
    Rhiassuring_2-1650527116837.png

     

    Rhiassuring_3-1650527304816.png

    Theeeeeeen before the Apply to Each starts over for another row, I clear the vars. 

     

    Rhiassuring_4-1650527344239.png

     

    I think the Office Script that @tom_riha mentioned sounds better, but, this was still fun to try.

    R

  • tom_riha Profile Picture
    10,085 Most Valuable Professional on 21 Apr 2022 at 07:17:10
    Re: In MS Flow is it possible to convert CSV into Excel

    Hello @Ahammad_Riyaz ,

    @DamoBird365 has a video where he does that using Office scripts: https://www.youtube.com/watch?v=ZejstvPiFZw

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard