Change format column from "General" to "Date"

Hello everyone!

I have an excel file with over 20,000 lines and I want to change the format of a column from “General” to “Date”, but without using for each because it takes a long time, the file having so many lines …
Do you have any suggestions for me?

Thank you!



@LZlz - Please check this post…

For your case, please use the below code in the Invoke code and Pass dtdate as in/out datatable variable in the “Edit Arguments”…

 dtdate.AsEnumerable().ToList().ForEach(Sub(row) row("YourColumnName")=Datetime.ParseExact(Datetime.FromOADate(cdbl(row("YourColumnName"))).ToString("M/d/yyyy"),"M/d/yyyy",CultureInfo.InvariantCulture))
1 Like


Gives me the error below


@LZlz - Please add system.globlolization in the import tab.

or use in the code as system.globlolization.cultureinfo.invariantculture…

Please try and let me know…

Now, gives me the error:

@LZlz - If possible share your file with few rows on it(after masking any sensitive info). I will share the workflow …

Test.xlsx (7.9 KB)
I have columns from A to AL, and the date is on column O. I want to format column O in “Data”. He is now “General.”

@LZlz - here you go…
ConvertOADate_LZ.xaml (5.8 KB)

Test_LZ.xlsx (9.0 KB)

Hope this helps…

Note: When you are running the real file, you have to make sure you don’t have any blank values in that column. or else the conversion will fail. If you have blank values in the column then you have to filter that out first and then pass that to the invoke code…

1 Like

You helped me a lot!
Thank you very very much! :hugs: :clap:

1 Like


If I have known the DateTime.FromOADate() earlier it could have saved a lot of hassle in solving the problem in this post

Thanks @prasath17
Learned an interesting method today.

1 Like

I would have another question. Can the font look and size be changed? I should have that excel file set to Arial 8. I’m just asking … :slight_smile:

For Changing font and font size , you have to either use UiAutomation to send hotkey OR Balareva activities…Please refer below…

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.