cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Slowpoke
Resolver I
Resolver I

Convert csv to xlsx using an excel sript

Hi everyone!

I'm building a flow to convert some csv files on my One Drive folder to the xlsx format.

I tried to use the method of DamoBird365: https://www.youtube.com/watch?v=9J6ThPWGaG0 , which consists in calling an excel script that we can found here : https://docs.microsoft.com/en-us/office/dev/scripts/resources/samples/convert-csv.

But when i run it, it get this error:

Slowpoke_0-1651748560901.png


Can someone help me resolving this error, or creating an other flow to achieve this?


For more details on my flow:

Slowpoke_1-1651748612453.png


The File Content part is used to generate an empty excel file.

I can provide other informations if necessary.

Thank you in advance

1 ACCEPTED SOLUTION

Accepted Solutions
takolota
Super User
Super User

@Slowpoke @Yutao

 

If you can’t get this script working, you can always try the CSV to Dataset template: https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/CSV-to-Dataset/td-p/1508191

 

It does everything inside Power Automate without premium connectors and it can handle several CSV parsing issues like commas, line breaks, or arrays within the data.

 

Also if you have a larger CSV that may take a while to re-post to an Excel table, then you can use these new batch actions:

https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Excel-Batch-Create-Update-and-Upsert/td-...

View solution in original post

2 REPLIES 2
Yutao
Microsoft
Microsoft

@DamoBird365 please chime in if you have more insights on this one, but based on the error message you shared, it seems the script failed at this line:

Yutao_0-1651774987382.png

 

And as I can see from the sample code, the "sheet" object (which got complained as undefined) comes from workbook.getWorksheet("Sheet1"). So can you double check whether there is indeed a worksheet called "Sheet1" in this workbook?

takolota
Super User
Super User

@Slowpoke @Yutao

 

If you can’t get this script working, you can always try the CSV to Dataset template: https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/CSV-to-Dataset/td-p/1508191

 

It does everything inside Power Automate without premium connectors and it can handle several CSV parsing issues like commas, line breaks, or arrays within the data.

 

Also if you have a larger CSV that may take a while to re-post to an Excel table, then you can use these new batch actions:

https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Excel-Batch-Create-Update-and-Upsert/td-...

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,646)