I have a List in my workflow. To this list, I add values extracted from multiple webpages using Add to Collection activity.
I have to store this List to an excel file over a specified range. The Write Range activity allows datatable as input. So I thought of converting the List to a Datatable but I haven’t found any expression that satisfies this use case.
Alternatively, I thought of using foreach activity on the List and assign each item to a row or column in datatable. But the datatable is empty.
Can you guys please advise on this? If you’ve some other alternative, it is welcomed.
Note: The count of items in List is undefined can be upto n values. Please refer to the attached workflow.Converttodatatableandaddtoexcel.xaml (11.4 KB)
Same as the way you tried will work, but leave it .
Simply use Excel application scope and inside that use for each activity and iterate the list you have.
Then use write cell activity to write each value to the excel. For dynamic range, declare a variable as count of type int32. Initialize it with 1. Increment its value before write cell activity and the range will be
Hello @HareeshMR, Thanks for the new alternative, this seems straight-forward and the correct approach.
I did as you illustrated above, but the excel loads empty which I don’t know why.
I’ve validated that the List is not empty by using foreach to print each item in the list, which returns value as expected.
For troubleshooting, I’ve attached the updated workflow. Could you please check and let me know if I’ve missed out anything. Converttodatatableandaddtoexcel.xaml (7.8 KB)