Error while passing data into Excel


I am occuring problem while trying to pass date into excel using write range.

Array used to add data row activity: {“blabla”, date.Today.ToShortDateString}

On write range step error is throwing:



Try to change the datatype of the column to String type. The actual type of your column is int32

How are you getting your datatable or where are you getting your datatable from? Your second column must be Int32 type, when it should be a string. If you’re using a Build Datatable activity, change the datatype of the column to String.

Hi, unfortunatelly it did not help. Still the same error.

Basicaly input is taken from excel sheet with read range property. Then I jjust do some add row operations.

Attach your workflow and excel sheet here if those are not confidential. This is probably a format issue. In excel, your date might be stored as a numeric value instead of a string or a date time object.

Here you can find a part which is problematic:


Read range is not visible on this printscreen but is DataTable has been initialized before. While assigning variables into array there will be more than one.

Regarding excel worksheet, you can consider is as empty in first iteration.


I think you’re using the wrong “write range” activity. Rectify that by using the write range which is inside the UiPath.Excel.Activities package, and this shall work.

That was a mistake too, stupid me :sweat_smile: But it throws again the same error which I showed in first post. So this is not an excel issue, only add data row activity.

Is there any solution to avoid inserting date as integer? Is it even possible?

Could you show me the excel sheet you’re using as the input? That’s where the change has to be made, if i’m not wrong. Like i said earlier, the datatype of the date column is neither datetime nor string, which is why it throws an error when you add a string instead.

Try one thing. Instead of adding date.Today.ToShortDateString, add this:


Let me know if this works.


I’ve changed it to date.Today.Ticks.ToString otherwise is not working in assign activity.

Can you explain what exactly you are trying to do? Reading from excel to datatable then adding some rows to existing datatable then again writing that down in new excel using Write range… Is that you are doing… also, do you file contains values in excel as dates?

Basically I need to add rows generated in daily routine to existing excel worksheet. These rows are containing dates. I am doing a little of my testings that’s reason why screens might not make sense for you but problem is how to insert data into excel worksheet. And as I said, even on brand new created excel it not works.

You can share your excel here. Let others work on it and see what exactly is happening. Could you do that, since without it this is taking a lot of time?

Sorry, new users can not upload attachments…but as I said this is empty sheet before first row is written.

Maybe other way, could you provide me simple sequence where inserting date is working? I will compare it and try to figure out what is going on.

Wait a minute. If there’s no data in excel, how are you getting your input datatable from? You said you were using “read range” to get the datatable values. But if the excel is empty, there won’t be a datatable to start with in the first place.

Yes, I did it by a bypass for this using Build Data Table activity. Made it simplier just for testing.

Please try with below steps…

  1. Build New Data Table (with columns as per your required data type)
  2. Add Data Row with array values as {123,123,123} in New created Datatable
  3. Post all rows are imported or added to data table then write range to excel… Do not use excel application scope if you are using Write Range - Workbook activity.

Attached workflow for reference.

Let us know if that works for you.
Main.xaml (6.6 KB)

1 Like

Check the data type of the column in Build Data Table inside which you’re trying to add a string value. If you’ve by mistake specified the column as int type, make changes to it and specify it as a String instead.