How to convert csv to excel file without loosing the date formats

How to convert csv to excel file without loosing the date formats

I tried with “Read csv” activity and that’s changing the date format from "1-Jun-22"to “01-JUN-2022”. How can I copy the same format as in .csv to excel?

I tried using “Excel application scope”, but has different issues with other columns.

Hey,
you can use BalaReva CSV Activity
i will help copy from CSV to Excel, without loosing Format
i am attaching the vedio, you can follow it
definitely it will help you
BalaReva CSV Activities - RPA Component | UiPath Marketplace
Thanks and Regards

@Rounak_Kumar1

I am not supposed to use any other activity except uipath activities due to security concerns

Hey,
you can use this function it will work
DateTime.ParseExact(VarDate.ToString.Substring(0) ,“dd-MMM-yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“d-MMM-yyyy”)

VarDate is a variable where storing the Input date(if you are using for each row then you can replce the Var date with row(“ColumnName”)

Thanks

@Rounak_Kumar1

Will that do the entire column in one go or row by row where I have to use for each?

In for each row you can use
Thanks

Hey
Is it working for you

Row wise I tried that already, it works.

But I have huge data and its taking lot of time. I have another vb.net code which does format the entire column at a stretch, but this issue with conversion from csv to .xlsx is creating a problem for that code as well.

Bottom line is to convert csv to .xlsx without loosing any format

Hello @Krithi1

If you want to convert from .csv to .xls you can simply do it using copy file activity without loosing the data format. Try attached workflow

Example.zip (2.8 KB)

@Ushu - I am getting file currented error if I do it that, but usually we can’t just rename a .csv to .xlsx. That won’t convert the file in the right way per my understanding

Hello @Krithi1

It can’t convert the .csv file to .xlsx but it can convert to .xls. If it shows any pop up while opening the converted xls file just click on yes. Then you can see the data that you want

Hello @Krithi1 ,

can you keep a static template for excel with the predefined formats for the columns? Then if you use Read csv and write to excel, i hope it will retain the same format based on the format which already predefined.

Thanks

@Rahul_Unnikrishnan

I think I can create a template as a part of my process itself, this might work, thank you very much for giving this thought. I will keep you posted on how it goes.