Creating a datatable from an array, DateTime datatype

Hi guys

I have a big excel file which I’ve read in as a Data Table. I’ve converted a date column in the excel file to the correct format, and now I wish to create a new datatable, and then finally paste these converted dates into the same column in the excel file.

The problem is that I’ve written the dates into an array, ‘dateArray’, and used the “build data table” activity to create a 1 column DateTime data table, ‘pasteDate’. I now wish to add my data from my array to my new DataTable, but I get the error:

"Argument ‘ArrayRow’: Compiler error(s) encountered processing expression “dateArray”. Vaue of type ‘1-dimensional array of Date’ cannot be converted to ‘1-dimensioanl array of Object’ because Date is not a refference type’

Any help would be greatly appreciated!

Welcome to the forum

give a try on following:

Use an assign activity
leftside: your1ColDataTableVar
right side:
(From x in dateArray
Select your1ColDataTableVar.Rows.Add(new Object(){x})).CopyToDataTable

refering to your screenshots your1ColDataTableVar would be pasteDate

1 Like

Thanks for the reply

I ended up just putting my code into an Excel Application Scope, and using the “write cell” activity, which is fast enough for my use - thank you!

Use this: