Convert XLS file to CSV

Hi

I would like to convert an XLS file to CSV when we receive an email.

Also i need to remove the headers and one last column

Can someone let me know how to go about.

Thanks

S

Hello @srinivass,

Take a look at this:

Regards,
Susana

1 Like

I did look at it, but couldn’t find anything in which converts to CSV in the workflow

Is it by just renaming it works.

image

image

Check the destination in Move File activity, is the extension being changed to CSV?

If so, type of conversation might not always work.

So Am i right in thinking by changing the extension to from XLS to CSV, it will work

In the move destination it says Path.GetFileNameWithoutExtension(item.ToString)+“.csv”

If the data is intact after changing the extension, you may use move file.

But since you have to do some manipulation why don’t you convert excel into a data table and convert it to csv after your header and column removal?

2 Likes

Ok thanks for the suggestion, I do the understand the datatable part of removing headers and column but how to convert

Do you mean I have to use a recording sequence and do save as.

I just tried to rename the xls file to csv and tried to open, i get the following error, if i click yes it opens the file

ReadRange from Excel file to a DataTable.
Use WriteCSV activity with that DataTable to write it to a CSV file afterwards.

Changing extension might work from a user perspective, but you’re essentially creating a fake csv file.
Yes, you can open it in Excel and it “looks” like a csv, but you can’t treat it as a CSV file - it’s still an .xls file inside. Whatever is supposed to consume that as an input (there has to be a reason why you need to convert it) will most probably crash, since it’s expecting a csv and gets an xls.

5 Likes

Thank you for the solution.

Sorry for bumping an old thread. But can you please share with me the xml file about this?
i already try the solution from @andrzej.kniola but can’t produce any results.
is there any example bout this?

Really sorry for bumping this old thread.

Thanks before
Cheers.

Delf

what do you want exactly, this was something i did couple of months back

the example .xaml file about this problem. I already tried doing it by myself but can’t get any results.

This is my project
Main.xaml (10.2 KB)
is there anything wrong with this?

Thanks before
Cheers

I could not convert xls to csv, but had to open the xls file and pick the data from it.

I cant run your xaml file because my UIPath licence has gone past its date.

sorry about that

S

hi @srinivass

Refer tthe below link for conversion

Regards
Sanjay Shankhla