PowerShell
PowerShell
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
# .xlsx files are Zip archives
$zip = New-Object Chilkat.Zip
$success = $zip.OpenZip("qa_data/excel/fakeCompanies.xlsx")
if ($success -eq $false) {
$($zip.LastErrorText)
exit
}
$csv = New-Object Chilkat.Csv
$sheetNames = New-Object Chilkat.StringTable
$success = $csv.XlsxGetSheets($zip,$sheetNames)
if ($success -eq $false) {
$($csv.LastErrorText)
exit
}
$i = 0
while ($i -lt $sheetNames.Count) {
$($sheetNames.StringAt($i))
$i = $i + 1
}