Basically what I need is to make one of the columns of my excel spreadsheet into a list of strings and I can’t seem to do it! Please help!!
Welcome to uipath community
yes of course we can do that
–use a excel application scope and pass the file path as input
–use a read range activity and get the output with a datatable variable named outdt
–create a variable named out_list of type list (of string) in the variable panel with the default value as new list(of string)
–use a for each row loop and pass the datatable variable as input outdt
–inside this loop use a activity called add to collection
and in item mention as row(“yourcolumnname”).tostring
and in collection mention as out_list
this will add all the values in that column to that list
Hope this steps would help you
Kindly try this and let know for any queries or clarification
Cheers @Olivia_Winter
I’m clearly doing something wrong here because i just can’t get out_list to be a list of string and get the default value to be new list(of string) without that blue bloody sign popping up and telling me that its a compilers error! Please help me
can i have a screenshot of that error
actually it should be like
variable name : out_list
type : System.Collections.Generic.List(of string)
scope : yoursequencename
default : new list (of string)
Cheers @Olivia_Winter
Change the variable type to a list<string>
variable that i’ll call StrList. In an assign activity put in: StrList = new list(of string)
This is what I can see and this is what I was seeing before I came on here! I’m new to UiPath so I’m probably doing something stupid, but I don’t know what that stupid thing is
Hello @Olivia_Winter alternatively you can try below as well…
Read your excel in to datatable dt
List<String> ListStr = (From rw in dt select x = rw("ColumnName").tostring).ToList
I believe the issue is with data type of variable out_list. It is of type Generic instead List<string>
I’ve tried, but I can’t! I don’t know what this means and honestly I’m close to throwing my laptop out the window
can you upload your xaml please
ROBOT PRACTICE RUN.xlsx (9.7 KB)
This is the fake one I’ve created to use when setting up the robot
give us XAML file not excel file…
Main.xaml (7.1 KB)
Hello @Olivia_Winter
There were two mistakes in your workflow one you were trying to create of list of array of string and second you did’nt change the datatype to list
Main (11).xaml (7.2 KB)
HI @Olivia_Winter
you were almost done
no worries
the reason were
–Creation of list variable in the variable panel out_list and it should be like with type
system.Collections.Generic.List(of string)
–keeping the scope of the variable outdt with whole sequence
–Then the next one is out_list initialization it should be new list (of String)
–then finally changing the type argument of add to collections to string
here you go with the resolved xaml
oliv.zip (16.7 KB)
hope its resolved
Cheers @Olivia_Winter
so any other stuffs to be discussed
were we able to accomplish this
Cheers @Olivia_Winter
Dont throw it…dont loose hope. A lot of hepful people here in our community if you have a problem in uipati just raise it here…we are happy to help.
cheers
Happy learning
Please help