Golang Open xls file error zip: not a valid zip file

-2

I'm using the "github.com/tealeg/xlsx" to read the content of xls file ,not xlsx. can it open a xls file ?

I try to rename the xls to xlsx , but failed to open it.


func excelDataTest(){
    excelName := "./xlsx/2019Q3.xlsx"

    xlFile, err := xlsx.OpenFile(excelName)

    if err != nil {
        log.Println("Open xlsx err --->", err)
    }

    for _, sheet := range xlFile.Sheets{
        for _, row := range sheet.Rows{
            for _, cell := range row.Cells{
                text := cell.String()
                log.Println("text ------>", text)
            }
        }
    }
}

panic: runtime error: invalid memory address or nil pointer dereference Open xlsx err ---> zip: not a valid zip file [signal 0xc0000005 code=0x0 addr=0x28 pc=0x5347f7]

goroutine 1 [running]:

go
xlsx
asked on Stack Overflow Aug 12, 2019 by CrazyRolland

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0