Read Excel with Dynamic Number of Columns


Please look at scenario below.

The tabular data is from Excel, which I need to extract and input the web form. Basically, the tricky part is after column E, where the number of columns are not fixed.

As you can see from OrgID 001, when column E (Siblings = Yes), we can maintain additional siblings details. In this case, there’s 2 siblings. So have to extract this info and input to web form.

But for OrgID 002, when it has only 1 additional sibling. Thus, just need to input the first sibling details.

I only know how to extract fixed column data via row.Item(“Column Name”).ToString. Please advise how can I achieve the requirements above. Thank you.

1 Like

Hey @liangws,

Read the entire excel by using read range.

Now If siblings field is yes, you will retrieve next set of values(3 columns) & then again do the same.

If the sibling name is not null or not empty you will consider as valid.

Hope this helps :+1:

Thanks :slight_smile:


Yes, I have use read range to read the entire excel. But I’m not sure how to read the next set of values (3 columns) and so on, without hard coding it with row.Item(“Column Name”).ToString.

I thought of using For Each item inside Read Range. Is this possible? I’m new to UiPath and have not explore this approach before, thus not really sure how to implement it dynamically.