(Go) XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets. Note: This example requires Chilkat v11.3.0 or greater.
success := false
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// .xlsx files are Zip_Ref.html">Zip archives
zip := Zip_Ref.html">chilkat.NewZip()
success = zip.OpenZip("qa_data/excel/fakeCompanies.xlsx")
if success == false {
fmt.Println(zip.LastErrorText())
zip.DisposeZip()
return
}
csv := Csv_Ref.html">chilkat.NewCsv()
sheetNames := StringTable_Ref.html">chilkat.NewStringTable()
success = csv.XlsxGetSheets(zip,sheetNames)
if success == false {
fmt.Println(csv.LastErrorText())
zip.DisposeZip()
csv.DisposeCsv()
sheetNames.DisposeStringTable()
return
}
i := 0
for i < sheetNames.Count() {
fmt.Println(*sheetNames.StringAt(i))
i = i + 1
}
zip.DisposeZip()
csv.DisposeCsv()
sheetNames.DisposeStringTable()
|