Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

power automate convert excel

Forum home » Delegate support and help forum » Microsoft Office general help » Power automate convert excel attachment to csv before saving on

Power automate convert excel attachment to csv before saving on

ResolvedVersion 365

Power automate convert excel attachment to csv before saving on

Hi I have set up a power automate flow for an email attachment to save to a sharepoint location when it arrives. This is functioning, however I want to put in a step to save the file as xlsx rather than csv. I'm using the step in flow but the file keeps saving as csv.

RE: Power automate convert excel attachment to csv before saving

Hi Holly,

Thank you for the forum question.

It sounds like your Power Automate flow is currently saving the email attachment in its original format (CSV), and you want to convert it to XLSX before saving it to SharePoint.

Here’s how you can achieve that:

Steps to Convert CSV to XLSX in Power Automate

Trigger: When a new email arrives with an attachment.

Condition: Check if the attachment is a .csv file.

Get Attachment Content: Use the "Get Attachment Content" action.

Create File (Temporary): Save the CSV file temporarily in OneDrive or SharePoint.

Convert CSV to Excel:
Use the "Create CSV Table" and "Create Excel File" actions (Premium).

Or use Excel Online (Business) connector:
Create a new Excel file.
Use "Add a row into a table" to populate it with CSV data.

Save as XLSX: Save the new Excel file to your desired SharePoint location.

Delete Temporary Files (optional): Clean up any temporary files created.

Common Pitfall
If you're using "Create file" and just changing the extension to .xlsx, it will still be a CSV file in content. You need to actually convert the content into Excel format.

Alternative: Use Power Automate Desktop
If you have access to Power Automate Desktop, you can:

Download the attachment.
Open it in Excel.
Save it as .xlsx.
Upload it to SharePoint.





Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: Power automate convert excel attachment to csv before saving

is there a way to do this without creating a temp file? I'm struggling a little to follow the instructions

RE: Power automate convert excel attachment to csv before saving

Hi Holly,

Yes, you can convert a CSV email attachment to XLSX in Power Automate without creating a temporary file, but it requires a bit of clever use of built-in actions. Here's a simplified version of how to do it entirely in the cloud, using Excel Online (Business) and Office Scripts (if needed):

Simplified Cloud-Only Flow (No Temp File)

Prerequisites:
The attachment is a CSV file.
You have access to Excel Online (Business).
You have a SharePoint or OneDrive location to store the final XLSX file.

Flow Outline:

Trigger: When a new email arrives (with attachment).

Condition: If attachment name ends with .csv.

Get Attachment Content.
Create a New Excel File (XLSX) in SharePoint or OneDrive.
Use Excel Online (Business):
Create a table in the new Excel file.
Use "Add a row into a table" to populate it with the CSV data.
Done: The file is now a proper .xlsx format.

Challenge:
Power Automate does not natively parse CSV into rows/columns. You’ll need to:

Use "Compose" to split the CSV content by line (split(body, '\n'))
Then split each line by comma to get columns.
Loop through each line and use "Add a row into a table".

Easier Option: Use Office Script (Recommended)

If you're comfortable using Office Scripts, you can:

Upload the CSV content into a new Excel file.
Run a script to parse the CSV and convert it to a table.


Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Thu 10 Jul 2025: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Microsoft Office tip:

Using the Windows Keyboard key

The Windows Key,(WK) typically found at the bottom left hand corner, can be found on most keyboards, and has a number of different uses:

To open the Start menu: WK
To minimise all windows WK+ D
To open all windows again WK+ shift + M
To open Windows Explorer WK + E
To move across the Task Bar WK + tab
To open the Search window WK + F
To open the Run dialogue box WK + R
To open the System Properties dialogue box WK + break

You may be able to perform other actions with the windows key depending on which programs you have installed on your PC.

View all Microsoft Office hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.