Although it can preserve the slashes for the format, the DataType after reading it will turn it as an object. Doing this, write ranging it after processing the datable would change the Number Format from Custom to General. Is there a way to preserve the Number Format after reading ranging? Thank you.
can you manually create an empty excel and set the columns (that you know will be date format) to the custom mm/dd/yyyy format, then save it somewhere
then before you use write range, copy the above excel template to a new file, then use write range to this file. Then your dates will be kept in the custom format
This is actually what my current process right now. Problem is, although it may looks like it uses the same Number Format. Excel doesn’t seem to recognized the dates in the said column, as legit date. Take a look at this one.
Can you try converting the dates to your required fomrat. because when you read the excel it will be like a string for each cell. So you can convert that to Datetime format.
I did this before. Create a New Data Column set as DateTime, Convert Current values to ShortDateString or Just Date Time, then write range. Although this works well for DateTime, my problem is I need to use the Custom Number Format.
Although they may seem to look the same(Both in MM/DD/YYYY format) unlike in the source file, Converting the Number Format of the Output File to other format(Like Long Date String) looks just the same as other formats. This is my indicator that it is indeed, the same Number Format with the Input File.
it seems like all your values were converted to string before write range, i tried doing a simple read range and write range to anther cell and it doesnt have this issue,
i manually added a single quote ’ before the date in C2 and it converted to string, otherwise its still a date with valid long date format
I didn’t format it actually, I just left it alone after read ranging. I tried getting the Column Data Type of the Column after read ranging, and it gives me an Object. I’ll try to send a simplified version of the xaml.
Here’s the the xaml file. This is a simple read range and write range workflow. Read Range.xaml (8.3 KB) Input.xls (58 KB)
The Input File Contains the BirthDate column, with a Custom Number Format.
Just Tried it, Still the same. I tried converting it to “dd/MM/yyyy” first, to see if the Custom Setting in the Template File would work. Surprisingly, it works if the date’s Month and Date can be interchangble in both date format(Eg, 10/10, 11/12) But Dates like 02/24/2022 and 12/13/2022 doesn’t seem to work.