Want to get sheet names of excel without opening the excel

How to collect sheets names of excel without opening the excel
HELP!!!

@anishakotian400

You can use Excel application Scope activity, Give the path of the file

Inside Excel Application Scope place Get Sheets activity which will output you a Array of Sheets

Use ForEach activity to loop into the sheet

Hope this may help you

Thanks

@anishakotian400

  1. Use Excel Application Scope activity and pass file path to it. Create one variable of type Workbook and set it to Workbook field. Let’s say varWB

  2. And then try below expression.

             arrSheets = varWB.GetSheets
    

Hi @anishakotian400

Please refer to the thread below!

Regards

2 Likes

Excel Application Scope opens the Excel file.

1 Like

Excel Application Scope opens the Excel file. He wants to read the sheet names without opening the Excel file.

1 Like

Hi @anishakotian400 ,

Please do not create duplicate of same question. I can assure you you will not get an answer any faster if you post it two times.

Your earlier question : How to get all the sheet names of excel without opening excel

As for the request of reading a file without opening. You will not find a solution to this. The closest you have to an answer is the answer from @Palaniyappan in the other post or the one suggested from @pravin_calvin.

As @postwick pointed out, all these approaches will in the background need to open the file either with visible flag as true or false. A file needs to be opened to read its content. any file on your system for that matter can only be manipulated if the user / system / program has permission to open the file.

If you mean without opening excel visually, then you can use visible flag as false.

Also if you want to ensure excel closes properly do use a kill process and pass the excel process name.

Better to use the Workbook activities for simple reads and writes. No need for Excel Application Scope, and it appears they do not actually open the file.

1 Like

Hi @postwick,

System—> File —>Workbook activities will not return a workbook object and thereby it provides no access to names of worksheets. He needs the worksheet names so the only options are

  1. Open Excel scope and use the excel workbook object to get to worksheets
  2. Use invoke code or invoke PowerShell and use interop module to get sheet names
  3. May be something using vb, I have no ideas here

Oh, sorry, I missed the sheet names part. Yes you are correct you can’t get to that info from Workbook. Probably Invoke Code is the least impactful way to get sheet names.

That’s pretty complicated vb.net code, though, and I think it would be less reliable than just Excel Application Scope.