Csv to xlsx converter

Hello

my robot renames a file downloaded from the internet in csv.

after renaming it, i converted to xlsx, but i’m having difficulties because the filename is variable.

so i cant convert to xlsx

Hello,

While renaming the file, can’t you simply do this?

If variableCSVFileName is your dynamic file name

Then target file name is: variableCSVFileName.Replace(".csv", “.xlsx”)

You will have to fetch the latest file using Directory.GetFiles("*.csv") and assign the file name to your variable variableCSVFileName

thanks

the internal structures of an excel file is different to a csv file.
So a simple changing of an extension will not doing a conversion between file folrmats.

Also if EXCEL can display a csv file renaming file extension is not converting the fileformat.

We would suggest:

  • read csv file activity - results to a datatatable
  • use the datatable and create excel by using EAS and write range
1 Like

Yep! That is another way to go. Funny though how Excel works when we right-click a CSV and open the file with Excel, but doesn’t work when we do a background file move/rename.

:slight_smile:

@AndyMenon

sometimes we call it damaging instead of opening :slight_smile:

:laughing: True. Very True!