Jump to content

Find hidden sheet in excel and delete it


Recommended Posts

Hi all, I have a problem to create script to read some information form the excel.

The excel file that I get has contained some hidden sheet and make my script take wrong information from the file.

So my idea is create scrip to delete all hidden sheet in excel before start reading the value inside.

I try to use _Excel_SheetList() to check all sheet but it can do only listing all sheet inside the file but it didn't gave me any info for hidden sheet. So I still cannot let the script know which one is hidden sheet.

Can anyone help me for some sample script to solve my issue?

Link to post
Share on other sites

Welcome to AutoIt and the forum!

There is no "hidden" property for a WorkSheet. Just a "Visible" property to not show this Sheet.
_Excel_SheetList returns a 2D array with two properties for each WorkSheet (please see the help file for details).
Loop through the array and check the Visible property. If True ignore the WorkSheet.

$For $i = 0 to UBound($aWorkSheets) - 1
    If $aWorkSheets[$i][1].Visible = False Then
        ; Do what you want to do with a WorkSheet you have to ignore like write to a log file
    Else
        ; Process the Worksheet
    EndIf
Next

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...