cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Convert xlsx. or xls files to csv files in a Sharepoint Document Library

Hi

 

Would anybody have a template or know how one would convert xlsx. or xls files to csv files in a Sharepoint Document Library.

 

When a xlsx or xls file is uploaded into a Shareppint Document Library - it is converted to a csv file

1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Most Valuable Professional
Most Valuable Professional

Hello @KayBains ,

there's an action 'Create CSV table' in Power Automate that will convert any array into a csv format.

You should 'List rows present in a table' (the original Excel file must have the data inside a table) to get all the rows from the Excel file, 'Convert CSV table' to convert the output from the 'List rows...' into a csv format, and then create a file from the data provided by the conversion. image.png



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

15 REPLIES 15
tom_riha
Most Valuable Professional
Most Valuable Professional

Hello @KayBains ,

there's an action 'Create CSV table' in Power Automate that will convert any array into a csv format.

You should 'List rows present in a table' (the original Excel file must have the data inside a table) to get all the rows from the Excel file, 'Convert CSV table' to convert the output from the 'List rows...' into a csv format, and then create a file from the data provided by the conversion. image.png



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
Heliant
New Member

what if you do not have table in xlsx. how you going to proceed? And also what if the file is in sharepoint?

RobFischer
Advocate III
Advocate III

This only works with .xlsx files. There is no way to work with a .xls file in microsoft power platforms and they offer no way to convert with flow. This needs to be addressed!

Anonymous
Not applicable

Hi all,

 

I tried this and it converted the xlsx to csv, however about 200 of the records in the original xlsx were missing in the csv output.  My Excel data are formatted as a table.  Any help would be appreciated!

tom_riha
Most Valuable Professional
Most Valuable Professional

Hello @Anonymous ,

try to go to the 'advanced options' in the 'List rows in a table' action and put some number in the 'Top Count' field, e.g. 1000. I think the action will return only 100 rows by default.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
Anonymous
Not applicable

Thanks so much!  I will give this a try in a few minutes.  Per the action, the default is "all" but maybe that's not accurate.

 

Capture.PNG

Anonymous
Not applicable

Hi

 

For me converting excel to csv works if i create table in excel but while conversion it add 2 new columns 

@OData.etag

ItemInternalId

 

How should i remove them before writing the output file to my azure storage.

 

Regards

Shilpi

Woody0
Regular Visitor

I believe Microsoft will eventually stop supporting .xls format, as Excel began using the .xlsx format with Excel 2007. It doesn't make sense to invest development dollars in legacy formats, so I wouldn't look for a native Microsoft .xls connector any time soon.  That being said, there are many legacy systems still putting out the .xls format, and most of those do NOT support using Excel Tables as many OOB connectors require.

There are several commercial providers that have single step actions to convert; I have been using one of them for a couple years now to convert .xls to .csv with very good results.  Some providers include Plumsail, Encodian, and Cloudmersive.  Most of these you can find by just scrolling through the list of available actions when building your flow.

Hello,
It works, however it is only copying 256 lines in the created .csv file. Any idea why and how to resolve it?

szefco
New Member

If you don't have table in excel file, then the solution is (answered was powered by Chat GPT 🙂

 

To convert an XLSX file into a CSV file using Power Automate (formerly known as Microsoft Flow), you can follow these steps:

  1. Begin by creating a new flow in Power Automate and select "Automated - from blank" as the flow trigger.
  2. Add a "Get file content" action and configure it to get the contents of the XLSX file you want to convert.
  3. Next, add a "Compose" action and set its input to the output of the "Get file content" action. This will convert the XLSX file content to a binary format that can be manipulated in subsequent steps.
  4. Add a "Create file" action and set its "File name" and "File content" properties. For the "File name" property, you can use an expression to concatenate the original file name with the ".csv" extension (e.g., "myFile.xlsx" becomes "myFile.csv"). For the "File content" property, set it to the output of the "Compose" action.
  5. Finally, save and test your flow to ensure that the XLSX file is successfully converted to a CSV file.

Note that depending on the size of the XLSX file, you may need to add additional steps to split the data into manageable chunks before converting it to CSV

Hi @gr962x,

 

I just encountered this same issue and found a solution from OptimalBI:

 

RTbmart_0-1692968085817.png

 

Late response, but hope this helps!

Hello @szefco ,
Your solution does not work for me : when opening the .csv file, nothing is encoded correctly, see screenshot (I have not opened this file with Excel prior, here how it does behave on notepad++ :

atreyu_0-1692974997265.png

When opening on Excel (web or Desktop), i have an error stating this is not a right format but the data is still there :

atreyu_2-1692975361895.png

 



Here is my flow: 

atreyu_1-1692975320746.png

 



Because we will be feeding an app with the .csv format, it has to be pristine.

@Heliant , did your find another solution ?
Do you have any other idea on how to convert an Excel file without table from xlsx to csv format ?

Thanks a lot

brtkurt
Regular Visitor

@atreyu I am facing the same issue is there any update on that issue? 

 

How did you figure it out?

Hey !
I'm sorry, it's been a really long time but here is what we could achieve :
We had to incorporate a table into the CSV.
Yhe one I'm showing you is the test that worked, in production it's a more complicated flow, I did not want to explain everything here 😄
atreyu_0-1714749414916.png
So, here is the little step by step :

  1. Trigger When a file is created. No need to explain, it is my source of data
  2. Then Initializing a variable for the table name (could be anything other than a variable, really),
  3. copy the file, just to have history if anything goes aloof.
  4. After that, we create a table in the original .xlsx file. I gave this table name the variable. Here is the Excel formula I used to determine the Table range :
=OFFSET('ColumnName'!A1,0,0,SUBTOTAL(103,'ColumnName'!$A:$A),10)

 

Be careful : we could do this because the xlsx file structure is always the same. The number of lines changes but not the number of columns.
Then :

  1. We list the rows in the table we just created


  2. We use the action "Create a csv table" from "Data operations" connector and we give in the "From" field the following formula: outputs('List_rows')?[body/value] 
    It allows you to get rid of any "Foreach" step.
  3. Finally, you create a new File under SharePoint : the "File name" field will be any name you want with the ".csv" extension behind it, and the "File content" field will be the output of the "Create a csv table" action.

    That's how I done it, it is perfectible, but it worked with those tests 😉

    Have fun flowing !

Thanks!! It solved my problem 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (648)