How do I read an array from an Excel config file

I’m going to use an Excel table as a config file. I’m willing to put an array of string as a value. How do I correctly read it from UiPath so that it could understand that it’s an array actually?

For instance, this is how the excel table might look:
Name Value
myString {“a”,“bc”,“de”,fghij",“k”}

When I previously used an Excel config I created a dictionary variable, say, “config”, in UiPath, of string and object. And then I created, say, an Integer variable and assigned Convert.ToInt32(config(“myValue”).ToString)

But how can I do it in the case I read what is supposed to be an array?

The only way I seem to have is to read it to a string variable and then split it by a comma. But I may miss something.

@MGMKLML Read it as string variable and split it by comma. I Think this will work correctly

@Manjuts90 Thank you :slight_smile: Yeah this is a way out but I thought there could be more elegant solutions, you know :smiley:

So, this is the solution? I am facing the same issue, I’ll give it a try and then I will post how it went. Many thanks in advance

1 Like

@ecarles Let me answer you. This is a solution indeed but I wouldn’t really like to use it regularly. You have to read it as a string, then split it, for instance, by comma, add Trim to each element and, if needed, convert it to an array of, say, integer. Kind of bulky.

You can though create a custom activity or a separate workflow which will have a string and a delimiter (a comma, for example) as an input and return an array of something you would like to return.

I don’t rule out that I may not know a method which enables you to convert an Object to an array or collection or Tuple or something like that.

3 Likes

Thanks for the reply!