How can I add a datatable as queue item?

Hello,

I am trying to convert an Excel file into a data table and add that data table as a queue item. I am automate data entry from this template and have each queue item be a single sheet from a larger excel file.

How can I add a data table as a queue item? Would I have to convert it to JSON and serialize it/de serialize it?

Thank you

1 Like

You can’t. Queue Items do not accept complex datatypes.

The usual way of doing this is to add a Queue Item for each row of the spreadsheet, ie individual transactions.

Why do you want to put the entire datatable into one queue item? That this is where your process led you tells me there are better ways to do what you’re trying to do.

You could convert it to JSON and store it as a string, but I don’t know what the limit would be on how big a string you can put into a Queue Item.

Hey @tom_mccaffrey

Once you have the datatable ready, just serialize it to a string…

JsonConvert.SerializeObject(datatable)

Just pass the above in the AddQueueItem item data properties as a field which can be retrieved later and de-serialized

Hope this helps

Thanks
#nK

@tom_mccaffrey Yes thats right. You have to convert the data table to JSON and load the JSON string to the queue. Once you retrieve the item(JSON string) from the queue you have to deserialize again. Use below to convert data table to JSON