Read range by header name

Hey guys, I have the following problem:

I need to read the data from a column, but the column ends up changing its index, in an excel it is in N3, in another one in N3, so I’m using the Find/Replace Value to filter by the content of the first line that would be the header, however, when putting the result of find/replace value in my read range it ends up reading all other columns as well.

Note: For some reason it takes a long time to read the column from the find replace value result

Hi @gustavo.souza ,

I guess you would require to modify the Expression to the below in the Read Range activity :

  1. Assuming you have N1 in the resultado variable, we would need to only get the Column Letter Name from it and then use that in the Range.
columnLetter = Regex.Match(resultado,"[A-Z]+").Value.Trim

Here, columnLetter is a string variable.

  1. The Expression in the Read Range, change to the below :
Excel.Sheet(planilha).Range(columnLetter+":"+columnLetter)
1 Like

where I use columnLetter = Regex.Match(resultado,“[A-Z]+”).Value.Trim ?

@gustavo.souza ,

It is to be done using an Assign activity.

I did what you said but it generated the error: Assign: Expression Activity type ‘VisualBasicValue`1’ requires compilation to run. Check that the workflow has compiled.

Also, in my assing there is nothing referring to regex when I write, should I download some library or something?
regex

@gustavo.souza ,

Could you re-type the expression and check, Do not copy Paste the Expression.

Also when copy Pasting use the one which is properly formatted as the one suggested by me.

1 Like

it worked, thank you very much

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.