How to change the format from .csv to .xls in automation

I have to download one .csv file from internet and i have to save it as .xls file. when i tried using recording it is not able to take that format…is there any other method to do that conversion.
Thanks
anantha

1 Like

please use save as option and save with .xls.
just how the way manually you will save the extension of the file.
Hope my inputs are useful

Thanks @rkelchuri for reply…
I tried in that way…using save as option using recording…but it is not taking that conversion…is there any other alternative

Hey @Ananthaeswar2

Just read that csv file by using “Read CSV” activity and then use excel application scope with your file name with extention and write the datatable returned by Read CSV with Excel write range activity. :slight_smile:

Regards…!!
AKsh

Thank @aksh1yadav for the solution…and when i am using write range activity…date format is getting changed from date to number format…suppose if the date is 8/30/2017 but it is coming as 452789 like that…how to get the original date format.
Thanks
anantha

Or you can use like

double dtvalue = double.Parse(row(Date));
DateTime dateInfo= DateTime.FromOADate(dtvalue)

1 Like

Hi,
Just wanted to point out that CSVs are comma delimitted and .XLS files are tab delimitted if I remember right. So technically you could just use Read Text to string then .Replace the delimitter and then Write Text using .XLS format.

However, that doesn’t work for .xlsx format.
I feel like reading it to a datatable then using Write Range would be more ideal if you can get the values to migrate correctly. Using Excel Scope with Excel Write Range will probably help with text and number formatting. The Write Range will save the file so no need to use Save As clicks.

Hi @aksh1yadav…i attached one sample excel sheet which contain date in general…could you please tell the solution how to do dat…i m getting some errors when i tried…
Thanks
AnanthaBook1.xlsx (7.7 KB)

See attached sample as per your excel.

Ananthaeswar2_Sample.xaml (9.2 KB)

image

Regards…!!
Aksh