Sample code for 30+ languages & platforms
Go

XLSX Get Sheet Names

Open an Excel spreadsheet (.xlsx) and get the names of the sheets.

Chilkat Go Downloads

Go
    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 := chilkat.NewZip()
    success = zip.OpenZip("qa_data/excel/fakeCompanies.xlsx")
    if success == false {
        fmt.Println(zip.LastErrorText())
        zip.DisposeZip()
        return
    }

    csv := chilkat.NewCsv()
    sheetNames := 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()