How to work with a collection having no header ?

shivam09

New Member
I'm accessing data from excel. There is only one row and that too without any header i.e the required data is also present in the first row. How to access the collection data as there is no certain column name?
 
I suggest you to insert a blank row above the row with the data and then get the "A1:"&[LastColumn]&"2" range as collection using Get Worksheet Range as Collection action in MS Excel VBO.
You can create your own action that inserts rows by modifying the Insert action in MS Excel VBO. Just change the code line range = excel.Selection to range = ws.Rows(1). In this case, the column names in the collection will be Column1, Column2, etc.
 
I'm accessing data from excel. There is only one row and that too without any header i.e the required data is also present in the first row. How to access the collection data as there is no certain column name?
Do you know what the fields in your collection should be? Some screenshots of the data would be helpful if possible. If you want headers, could you insert them into the Excel file first using Blue Prism?
 

VJR

Well-Known Member
I'm accessing data from excel. There is only one row and that too without any header i.e the required data is also present in the first row. How to access the collection data as there is no certain column name?
Hi shivam09,

You can do as suggested by @Irina_Milyanenko and you can then access the columns as Column1, Column2 and so on.
The only different thing you need to do is you can insert a row without a code stage. Refer post #7 here to insert a new row for the header. Provide the Cell Reference parameter as "1:1" in the Select action.

Another approach is as suggested by @nickbell123 where you can insert the header row as above and then use 'Set cell value' action to set each of the headers as per your needs.
 

shivam09

New Member
Hi shivam09,

You can do as suggested by @Irina_Milyanenko and you can then access the columns as Column1, Column2 and so on.
The only different thing you need to do is you can insert a row without a code stage. Refer post #7 here to insert a new row for the header. Provide the Cell Reference parameter as "1:1" in the Select action.

Another approach is as suggested by @nickbell123 where you can insert the header row as above and then use 'Set cell value' action to set each of the headers as per your needs.

Thanks, it worked.
 
  • Like
Reactions: VJR
Top