Writing Date Strings in Excel and Format on VM Robot machines

Hi

I’m experiencing an odd problem when writing dates as strings into Excel.

The task is to simply write a date as string in format ‘dd/MM/yyyy hh:mm:ss’. For example
Now.ToString(“dd/MM/yyyy HH:mm:ss”). We’re in the UK.

Using either the old or new Write Cell or Write Range, in Studio on my development machine the date appears in Excel correctly: e.g ‘01/07/2026 …’ for 7th January.

However, on the Robot VM machine the date is written as ‘01/07/2026…’.

We can’t explain this behaviour and to date all the bots that write date or date/time use 'ToString(“MM/dd/yyyy HH:mm:ss”) for the day and month to appear correct in Excel. This is a fudge I’m trying to avoid.

We’re using Office 365. The Language setting is ‘English (United Kingdom).’

Ideas/suggestions of avenues of exploration to explain and fix this much appreciated.

Hi @steve.wakley,

I also did face similar kind of issues when working with dates in the excel files. Per my knowledge, this behaviour is not from UiPath and it’s from the MS Excel.

So, to avoid this, we added additional character at the end (single quote) so excel considered it as a string and did not react with it. Later whenever we read the excel, removed the extra character (single quote) and used it.

Hope this helps.

Happy Automations!

Hi Rohit,

Thanks. That it works fine on our dev laptops in Studio implies that it could be either:

  • a difference in the date/time format on the robot VMs (the build of the VMs is provided and managed by a different team that manage our desktops)
  • an issue in UiPath Robot.exe that changes the remote virtual session to make Excel think the date that it sees is the other way round via the UiPath excel Add-in.

If everyone is having to do this, then it would be useful to know from UiPath that is a known problem that they are themselves unable or unwilling to fix in conjunction with Microsoft.

Given the number of bots built to date where a fudge has had to be applied, it would be dangerous if the root cause of the problem with the robot VMs was identified and solved, as it would mean a large maintenance activity to identify all of the bots that would then be adversely affected.

I agree with you @steve.wakley on this, it should have been fixed. It was long back when I observed this issue, almost 2 years back.

Hi @steve.wakley
Try Below,
You could try writing the date value directly instead of converting it to string. After that just format the column in the format as you needed. This may avoids the date issue on VM machines. Refer the image below

Hi @steve.wakley

The robot VM likely has different regional settings (e.g., US instead of UK), causing Excel to interpret dates differently.

To fix, either set the VM’s regional settings to UK, or write the date as text by adding a ' before it, or write a DateTime value and set Excel’s cell format to your desired date format.