How to convert Excel files to CSV files.(Power Automate Desktop)


Japanese version.

Introduction to transcribing the contents of one worksheet in an Excel book to a CSV file.

This flow does the opposite of How to convert CSV files to Excel files.
This flow can be configured to support not only CSV, but also TSV, arbitrarily delimited files, and fixed-length formats.

Overall view of Flow

Robin(for copy and paste)

It can be copied and pasted into Power Automate Desktop.

Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Test\\src.xlsx''' Visible: False ReadOnly: False Instance=> ExcelInstance
Excel.SetActiveWorksheet.ActivateWorksheetByName Instance: ExcelInstance Name: $'''Sheet1'''
Excel.GetFirstFreeColumnRow Instance: ExcelInstance FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow
Excel.ReadFromExcel.ReadCells Instance: ExcelInstance StartColumn: 1 StartRow: 1 EndColumn: FirstFreeColumn - 1 EndRow: FirstFreeRow - 1 ReadAsText: False FirstLineIsHeader: False RangeValue=> ExcelData
Excel.CloseExcel.Close Instance: ExcelInstance
File.WriteToCSVFile.WriteCSV VariableToWrite: ExcelData CSVFile: $'''C:\\Test\\dst.csv''' CsvFileEncoding: File.CSVEncoding.UTF8 IncludeColumnNames: False IfFileExists: File.IfFileExists.Overwrite ColumnsSeparator: File.CSVColumnsSeparator.SystemDefault

Flow creation steps

Set up Excel Launch Action.

Launch Exceland open the following document
Document pathPath of the Excel file to be converted.
Make instance visibleOFF

Set up Set active Excel Worksheet Action.

Set up Get first free column/row from Excel worksheet Action.
There are no parameters to set if they are set up in the correct order.

Set up Read from Excel worksheet Action.

RetreiveValues from a range of cells
Start column11 is the setting for conversion from the first column.
Change as appropriate depending on the range to be converted to CSV.
Start row11 is the setting for conversion from the first row.
Change as appropriate depending on the range to be converted to CSV.
End column%FirstFreeColumn - 1%
End row%FirstFreeRow - 1%
Get cell contents as textOFFOn if you want to reflect formatting such as comma delimited.
First line of range contains column namesOFF

Set up Close Excel Action.

Set up Write to CSV file.

Variable to write%ExcelData%
File PathDestination file path.

For those who want to learn Power Automate Desktop effectively

The information on this site is now available in an easy-to-read e-book format.

Or Kindle Unlimited (unlimited reading).

You willl discover how to about basic operations.

By the end of this book, you will be equipped with the knowledge you need to use Power Automate Desktop to streamline your workflow.


Tips(Power Automate Desktop)