+ Reply to Thread
Results 1 to 2 of 2

"Ghost" sheet objects returned while using Excel.Application

  1. #1
    mjohnson
    Guest

    "Ghost" sheet objects returned while using Excel.Application

    I am trying to parse a spreadsheet using JavaScript and I'm finding
    "ghost" Sheet objects in the file. It seems that if the user copied
    and renamed the file and then deleted some tabs that those tabs are
    still accessible programmitcally. If I view the excel file in Excel or
    try to load it into SQL Server then the "ghost" tabs don't show up.
    But if I read it using the Excel.Application in JavaScript then they
    show up. Here's an excerpt of what I'm doing:


    var wb = XLS.WorkBooks.Open(fname);
    var ws = XLS.Sheets;
    var cell = null;
    var e = new Enumerator(XLS.Sheets);
    for(;!e.atEnd(); e.moveNext() )
    {
    Sheet = e.item();
    cell = Sheet.Cells(1,GetPos("D"));
    WScript.Echo( "\t"+Sheet.Name+" -- " + cell.Value );
    }

    this is the output:

    Power Survey 1190 ALLENE.1 - Complete.xls:
    Basic Power Audit -- ATLN-CPOP-6
    Fuse Panel Sheet -- ATLN-CPOP-6
    Fuse Panel Sheet (2) -- 250 WILLIAMS (FOCAL)
    Fuse Panel Sheet (3) -- 250 WILLIAMS (FOCAL)

    I cannot visually see sheets (2) and (3) but I can dump them just fine
    with my script. This makes it problematic for me to parse because I
    will inadvertantly suck in data that I shouldn't...

    The BOL do not describe any useful attribute for the Sheet object to
    help me determine how to ignore these false sheets in the workbook. Any
    suggestions how to ignore these "ghost" sheets?
    thanks for your time,

    Mark


  2. #2
    mjohnson
    Guest

    Re: "Ghost" sheet objects returned while using Excel.Application

    Figured out that I could check the Sheet.Visible attribute and it was 0
    for the "ghost" sheets...


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1