Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not a valid zip file #207

Closed
justdoitgo opened this issue Apr 9, 2018 · 24 comments
Closed

not a valid zip file #207

justdoitgo opened this issue Apr 9, 2018 · 24 comments

Comments

@justdoitgo
Copy link

wps

@xuri
Copy link
Member

xuri commented Apr 9, 2018

What's the version of the Go and Excelize you are using? Please provides environment details (OS, WPS version) and file attachments if you can and provide detailed information according to the issue template when creating an issue.

@vinceyoumans
Copy link

I am also getting an error when I try to load this xlsx file.
err=====================
zip: not a valid zip file

`//package PBCONVxlsx2csv03
package main

import (
"fmt"

"github.com/360EntSecGroup-Skylar/excelize"

)

func main() {
//excelFileName := "EPlan_AP_LastSixMonths.xlsx"
//excelFileName := "./EPlan_AP_LastSixMonths.xlsx"
//excelFileName := "EPlan_SubmitRequest_LastSixMonths.xlsx"
excelFileName := "./EPlan_SubmitRequest_LastSixMonths.xlsx"

//xlsx, err := excelize.OpenFile("./Book1.xlsx")
xlsx, err := excelize.OpenFile(excelFileName)
if err != nil {
	fmt.Println("err=====================")
	fmt.Println(err)
	return
}
// Get value from cell by given worksheet name and axis.
cell := xlsx.GetCellValue("Sheet1", "B2")
fmt.Println(cell)
// Get all the rows in the Sheet1.
rows := xlsx.GetRows("Sheet1")
for _, row := range rows {
	for _, colCell := range row {
		fmt.Print(colCell, "\t")
	}
	fmt.Println()
}

}
`

/Users/vyoumans/Documents/PBeachChallenge/EPlan_AP_LastSixMonths.xlsx
EPlan_AP_LastSixMonths.xlsx

EPlan_AP_LastSixMonths.xlsx
EPlan_AP_LastSixMonths.xlsx

@navono
Copy link

navono commented May 14, 2018

I am also have the same problem.

OS: win10 1803
Go: 1.10.2
Excelize: master

OpenFile xls file get zip: not a valid zip file error. I copy the file content to a new xlsx file, the OpenFile successes.

@xuri
Copy link
Member

xuri commented May 15, 2018

@vinceyoumans Thanks for your issue. Please make sure your attachment EPlan_AP_LastSixMonths.xlsx can be open by Microsoft Excel™ application.

@navono
Copy link

navono commented May 18, 2018

binary

对比了下xlsxlsx文件,发现它们的文件起始的格式不一样。zip包的findSignatureInBlock会去判断前面的字符来确认文件格式。所以导致加载xls失败。
1.xlsx

上面1.xlsx是Office 2013生成的。在上传xls的过程中,居然也出现了下面的格式不正确的错误。
error

@calvinchankf
Copy link

@navono thanks for your info, so what is your way to workaround it?

@navono
Copy link

navono commented Jun 20, 2018

@calvinchankf for now, copy the content to a new .xls or xlsx file by hand....

@calvinchankf
Copy link

calvinchankf commented Jun 20, 2018 via email

@navono
Copy link

navono commented Jun 21, 2018

@calvinchankf You're welcome. If you find a better way, please let me know.

@markx1916
Copy link

I also meet this problem , I just copy the content to a new .xls or xlsx file by hand .

need help!

@navono
Copy link

navono commented Apr 19, 2019

If you have a lot file .xls files, may be can write a script to transfer all files extension to .xlsx.
I haven't test the solution, just a thought.

@mahesh-sanikommu
Copy link

any fix for this issue?

@vasiliyb
Copy link

vasiliyb commented Feb 2, 2020

@mahesh-sanikommu convert .xls to .xlsx ... i think

@xuri
Copy link
Member

xuri commented Mar 13, 2020

This lib doesn't support the older binary xls format currently. I will close this issue. The issue #44 still discussing the xls format.

@xuri xuri closed this as completed Mar 13, 2020
@iSenninha
Copy link

@mahesh-sanikommu convert .xls to .xlsx ... i think

so sad....

@BlackCodes
Copy link

so sad...

@winter-dev
Copy link

so sad...

@MKquant
Copy link

MKquant commented Nov 17, 2021

so sad...

1 similar comment
@cahyaramadhan
Copy link

so sad...

@XieWeiXie
Copy link

so sad...

@shikingram
Copy link

No Solution?

@xuri
Copy link
Member

xuri commented May 18, 2023

Hi @shikingram, this issue has been closed and merged into issue #44. Currently, there is no plan to add support to the legacy xls format spreadsheet.

@blusewang
Copy link

so sad...

@yasir16
Copy link

yasir16 commented Sep 18, 2024

I just had this problem, 4 days ago it going well, but yesterday this issue appeared

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests