Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "zip: not a valid zip file" error in Go?

Tags:

go

I'm newbie in Golang. I use a link to read xlsx file:

    filePath := "controllers\\foo.xlsx"
xlFile, err := xlsx.OpenFile(filePath)
if err != nil {
    log.Fatal(err)
}

My program run on window os. Thanks in advance.

like image 638
Phú Văn Avatar asked Oct 29 '25 06:10

Phú Văn


1 Answers

use this :

    file, fileHeader, err := req.FormFile("theAttachmentfile")

    if err != nil {
      do what you wanna do
    }

    xlsx, err := excelize.OpenReader(file)
    if err != nil {
      do what you wanna do
    }
like image 60
Almaida Jody Avatar answered Oct 31 '25 06:10

Almaida Jody