Forum Discussion

anumolu9999's avatar
anumolu9999
Contributor
6 years ago

Working With Excel Files via COM: set required sheet as active using javascript

I am using excel, which has two sheets. I have to use COM to read excel because of microsoft access database issue. I have to access the second sheet in the excel based on its name.   Code is as b...
  • SebastianP's avatar
    6 years ago

    Try this out,

    filePath="C:\Users\sebastian\Desktop\Sample.xlsx";

    SheetName="Sheet2";

    Excelbook= Excel.Workbooks.Open(filePath);
    var xlsheet = Excel.ActiveWorkBook.WorkSheets.Item(SheetName);

     

     

    I am using the aove and its working