How to get a GenericValue variable inserted to a datatable


I had to use some string manipulation to edit some data from a data table and after the string manipulation the output variable is GenericValue, what would be the best way to get this entered/changed in to a data table again?

This is is what it looks like now. I would need to get the “finalprice” variable into a excelsheet but I can’t use write range because the type is GenericValue.

‘Write Range’ will only accept DataTable. In order to input this ‘finalprice’ to ‘Write Range’ you may have to create a new DataTable & add a new row with each ‘finalprice’ value to this table. If you want this to be inserted into the excel file directly then just use ‘Write Cell’ activity which inserts a particular value to a cell position.

Let me know if it helps.

Rammohan B.

Do i need to manually add each ‘finalprice’ value to the table? That would be a problem since the data I’m scraping changes every week and it would be great if whole the process could be done automatically. And the problem with ‘Write Cell’ is that it only writes the first cell from ‘finalprice’ which is a long line of different values.

Ohh No. I mean there is an activity called ‘Build Data Table’ which you can use to create a DataTable. After that use ‘Add Data Row’ to create a new row for this newly created DataTable. ‘Add Data Row’ activity goes within your for each row which will keep on creating a new row for each iteration from your previous DataTable. You can then use a ‘Write Range’ activity and pass this newly created DataTable to create a new excel file.

I hope you don’t want to update the finalprice it in the same old excel file? Just to confirm in case i misunderstood you.

You can get the current index of the row within the for each loop and use it within. If i is the index and ‘A’ is the column then Write Cell value contains “A” + i.ToString

Well the plan was to add finalprice to an existing excel file but I can make a new one too, I’ll try if i manage to do this, thanks for the answers!

Been a bit busy the last few days so sorry for asking about this again but i haven’t figured out how exactly I’m supposed to do. Does it matter where i put the ‘Build Data Table’ inside my workflow? And what do i do with the ‘Add data row’ after I have inserted it inside the ‘For each row’?

Can i skip the build data table part by using write cell and the “A” + i.ToString example you used?