cancel
Showing results for 
Search instead for 
Did you mean: 

How to get sheet names from Excel workbook?

Highlighted
Contributor

How to get sheet names from Excel workbook?

I am looking for a way to read all of the sheet names from an Excel workbook.  Since the ExcelDriver requires a sheet name I am not sure how to do this.  I am using C# script.  Any ideas?



Thanks
1 REPLY 1
Highlighted

RE: How to get sheet names from Excel workbook?


Hi,





For a workbook that is already opened, you can do this by using the script below:





    var ExcelObj = Sys.OleObject("Excel.Application");

    for (var i = 1; i <= ExcelObj["Sheets"]["Count"]; i++)    {

        Log["Message"](ExcelObj["Sheets"]["Item"](i).Name);

    }

--
Dmitry Nikolaev

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors