Bogdan Nechyporenko
Bogdan Nechyporenko

Reputation: 1346

Parse Excel file using Go on OS X

I'm trying to read Excel file with GoLang (even not .xlsx) and by using several libraries can't have success in it. The libraries just crashes on OpenFile stage with such error:

zip: not a valid zip file

Libraries which I tried to use: https://github.com/tealeg/xlsx https://github.com/tealeg/xlsx2csv/

There were some others too, but they were crashed during

go get Name-of-Lib because of some Dll problems.

Any ideas? Is it because I'm trying to do in under MacOS or by some other reason?

Upvotes: 4

Views: 2932

Answers (1)

Grzegorz Żur
Grzegorz Żur

Reputation: 49201

The libraries you are trying to use 1, 2 support only newest Microsoft Excel format which is actually a zip with xml documents. Therefore you get error: zip: not a valid zip file. Those can be used on your MacOS, but first you need to convert the old XLS files into XLSX files. You should be able to convert them with LibreOffice in headless mode like described other question, you can run a process from your code.

The other libraries are failing with "dll" errors because they must be linked against Windows Dynamic Link Libraries. As so, they are not usable on your MacOS.

Upvotes: 4

Related Questions