How to check whether the sheet name available in workbook or not

How to check whether the sheet name available in workbook or not

I hope workbook here refers to the excel itself

Use Get Workbooksheets activity @RachelN

Lookup in the output of this activity -
If List.Contains("yourSheetName")

Regards,
Karthik Byggari

2 Likes

@RachelN Can you specify which sheet name you needs to check

I cant use excel application scope as i dont have excel installed.

I have permission to use workbook only.

So please help me to get the sheet names from workbook

I cant use excel application scope. @HareeshMR

Please suggest me some other option to fetch the sheet names

Hello @RachelN
try using this method
First Take An Assign Activity and assign this code
New UiPath.Excel.WorkbookApplication("Your File Path")
to variable of Type UiPath.Excel.Workbook

than Take Another Assign Variable and assign this code
VariableFromFirstAssign.GetSheets
To a variable of Type System.Collections.Generic.IEnumerable<system.String>

You’ll get list of all sheets in that Particular WorkBook now you can use
.Contains method to check whether your required Sheet is present or not

Check this workflow for better understanding
ExcelSheets.xaml (6.5 KB)

2 Likes

Hi @vickydas

For this code , excel needs to be installed.
In my case, excel is not installed.!!

So am getting the error

Hi @RachelN, Did you check the solutions that are here in the forum? for example here … Is it possible to get sheet's names without opening Excel?

let us know if that solve your problem

cheers