Read Range help


I’m looping through a local folder loading excel files into a SQL database.

I’m getting errors when the tab names are different.

Can someone help me adjust the Read Range sheet name to a IF condition?

I would like it to read range if the activesheet is “Sheet1” or “Travelers”.

Any help would be greatly appreciated.



@timothy.mullady -

1.Use “Get workbook sheets” inside the excel app scope…this will give the all the sheets from the workbook…

  1. Use For Each - and loop through sheets(List) from the step 1

  2. Inside the for each, write if condition like contains(“Sheet1”) or (“Travelers”)

  3. Then use the read range - and use “item” as the sheet name…

Hi @timothy.mullady,
Here is an illustrated example

In the foreach properties, don’t forget to put “string” as a TypeArgument


I would suggest instead of If statement, use Switch statement.

It will make your work easy to understand also.

Sahil Garg

1 Like

Is there anyway you can show me visual for workflow?

Assign - Array_Files = directory.getFiles()

Loop - For Each Item in Array_Files

Assign - FileName = Path.GetFileName()

Excel Application Scope
Path + FileName
Read Range

I’m trying to run one sheet. The file generally has one tab “Sheet1” or “Travelers”.

If I set Read Range tab to “Sheet1” and the file has “Travelers” it breaks.

@timothy.mullady - That’s what I told early…you should not set the name of the sheet …it should be from the for each activity…like this.


Give me sometime I will share the workflow…

1 Like

Would that help you ?
Sequence.xaml (10.5 KB)


thanks for your help!

1 Like

Thanks for your help!

hi Sahil Garg, I don’t think switch statement would be beneficial…because there are two cases, Either “Sheet1” or Travellers" in both the cases user is going to perform the same action…So if you use Switch you end up in copying the same statements to other case which is redundant.

1 Like

Ohh, yes you are right, switch will increase the code in this case.

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