I have an excel with 3 column
i want to get the data from the column “CLAIM NUMBER”
Condition is that The column name can have some changes for every rpa run like this
for example : claim number name can be changed to “CLAIM NUMBER_02”
but the “CLAIM NUMBER” will be same and some added data,
so can we pullout data from that column
You can iterate the every row of column by using for each row in datatable.
You can give like this Currentrow(“CLAIM NUMBER”*).toString
Hope it can help you!!
If the position of the column is fixed then use the column index instead of name to access it
alternately you can get the column names and get the exact name using below in assign
ColumnName = dt.Columns.Cast(Of DataColumn).Where(function(x) x.ColumnName.Contains("CLAIM NUMBER"))(0)
You can read the data into a datatable and check the header using a contains method.
what if the column index is also changing can we pull the data
This can be used in that scenario to get the exact name and then subsequently can use it
Hi @Gokul_Murali ,
Prior to start Iterating the Loop to read data,
you can find the exact column name by doing the following:
create a variable for ClaimNumberColumn as String;
and ColumnCollectionNames as DataColumnCollection
Start a for each loop on ColumnCollectionNames and in an if condition write the below expression:
in the then section ClaimNumberColumn=item.ColumnName
that way you would be able to get the column name and then you can use it as needed.
you can use .toString at the end
Please add a .ColumnName like below
ColumnName = dt.Columns.Cast(Of DataColumn).Where(function(x) x.ColumnName.Contains("CLAIM NUMBER"))(0).ColumnName
Hope this helps
i got an error like this
I believe you copied exactly…please remove inverted comma and add them back in the studio
it is working fine thank you,
i have one more doubt if the column name in the excel is full upper case or full lower case does it work if not how can i alter the expression
Iam asking regardless of upper or lower case in excel column name should it matches
can we do like that in the expression
.ToUpper will convert every letter to upper case whatever it gets as input let it be upper or lower case…so the comparision as I gave all upper i gave .Toupper to convert anything we get into upper case and then compare
Hope this helps
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.