Error in converting lists to datatable Uipath

Hi, @everyone

I am using Pythonscope in getting a desired list, this list I have to write it in a excel file, may I know how can I convert the list of strings into datatable variables?

There is an error in conversion, how do I convert list into datatable, should I use assign activity or what is the process to covert ?

Thanks

Good afternoon Hemant,

Does this solution resolve your issue? Convert a list to datatable - #2 by ClaytonM

No, any other way please

Hi @hemant_6,
It is better to write each item(using for each activity) from list to Data Table(using write cell activity).
I hope it helps you :slight_smile:
Best Regards,
Likith Rajesh.

2 Likes

This is the correct way @likith_rajesh suggested!!!
Converting list to datatable is an hassle I’ll say

Seconding @likith_rajesh and @Shubham_Varshney

I’ve spent hours trying to find a single line (assign) way to do it and no luck.

The loop isn’t nearly as intensive as you would expect :slight_smile:

2 Likes

@chenderson @likith_rajesh @Shubham_Varshney
the one liner would look something like this:
strList.ForEach(Sub (s) dataTableVar.Rows.Add({s}))

But as this is not returning something, it cant be used by an assign activity
Using an Invoke Method maybe could work. Unfortnately I failled on the first try and then I stopped RnD.

So I aggree, do it within a for each

3 Likes

Welcome to the bandwagon ppr!

@chenderson @likith_rajesh @Shubham_Varshney
Technicaly it is possible

Main.xaml (6.6 KB)

I found a silly trick to do this and added on exsting rows new rows. For validation reasons I included Stringlist index as well

@hemant_6 sorry for taking away your post for this challenge. Never use my RnD and go for a for each activity. Please mark one of the guys above with the solution flag. So others can benefit from this. Thanks

3 Likes

Wow, amazed we could do this!!! Amazing RND work @ppr i’ll say :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.