We can add a new column to the excel spreadsheet, is it possible to define the format as say "mm/dd/yyyy’ and text aligned to right?
I am able to add a column and populate values, but could not figure out a way to format the newly created column
We can add a new column to the excel spreadsheet, is it possible to define the format as say "mm/dd/yyyy’ and text aligned to right?
I am able to add a column and populate values, but could not figure out a way to format the newly created column
Buddy @Geetha
This can help you buddy for sure
https://go.uipath.com/component/excel-extension-activities
or you can simply change the input value to the column instead of trying to change the format of the column which is not feasible as if the input format varies if will be of great problem, so we can change the input string datetime format to the format we want and if you are facing any issue with datetime conversion, use this format to convert a string of datetime to a datetime type of value
Datetime.ParseExact(“yourdatetimestring”,“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)
where this is optional buddy that is the last part .ToString(“dd/MM/yyyy”) in order to convert the datetime to string if needed to be assigned to a row - column cell
and
keep in mind that the format of yourdatetimestring, this is very important that , as the next format we mention in double quotes should match with it, i.e., if we have yourdatetimestring of format d/M/yyyy, then the next format mentioned in quotation should be of same type like “d/M/yyyy”,
Additional – to get the time as well , mention like this dd/MM/yyyy hh:mm:ss tt, where tt is AM or PM, BUT again keep in mind that this format or whatever format you mention here should match with the input string you provide, else you will be facing error like String was not recognized as a valid DateTime
Thats all buddy you can try with either of the method
Kindly try and let know buddy @Geetha
Cheers
Hi @Geetha,
You can use invoke code activity for excel formatting in “mm/dd/yyyy” and write code in below format. This works
Refer the below steps mentioned in the post to eliminate unexpected error while using Microsoft.Office.Interop.Excel
However, I personally feel that @Palaniyappan suggestion to change the input value of the column is better.
References that will help-