Problem with Excelize - It was working in previous Golang version

I was using Excelize for a long time
In golang 1.20.1 and in 1.20.4

I installed golang 1.20.5 and .go program stopped working:
.\myprogram.go:6397:10: fexcel.SetSheetViewOptions undefined (type *excelize.File has no field or method SetSheetViewOptions)
.\myprogram.go:6398:13: undefined: excelize.DefaultGridColor
.\myprogram.go:6399:13: undefined: excelize.ShowFormulas
.\myprogram.go:6400:13: undefined: excelize.ShowGridLines
.\myprogram.go:6401:13: undefined: excelize.ShowRowColHeaders
.\myprogram.go:6402:13: undefined: excelize.RightToLeft
.\myprogram.go:6402:13: too many errors

I then tried to get a new version from Excelize

BELOW , GH is github.com , and GOL is golang.org, because I can’t put more than 2 links here in this forum, as I’m a beginner here in this forum

myprogram.go:155:2: no required module provides package GH/qax-os/excelize; to add it:
go get GH/qax-os/excelize


go.mod:
go 1.20

require (
GH/qax-os/excelize/v2 v2.7.1 // indirect


in myprogram.go:
import (
“GH**/xuri**/excelize/v2”

I’ve tried also:
“GH/qax-os/excelize/v2”

$ go run myprogram.go
myprogram.go:159:2: GH/qax-os/excelize/v2@v2.7.1: parsing go.mod:
module declares its path as: GH/xuri/excelize/v2
but was required as: GH/qax-os/excelize/v2


After that I used:
in go.mod:
GH/xuri/excelize/v2 v2.7.1 // indirect

in myprogram.go:
“GH/xuri/excelize/v2”

Then myprogram.go gives the following errors:
.\myprogram.go:6397:10: fexcel.SetSheetViewOptions undefined (type *excelize.File has no field or method SetSheetViewOptions)
.\myprogram.go:6398:13: undefined: excelize.DefaultGridColor
.\myprogram.go:6399:13: undefined: excelize.ShowFormulas
.\myprogram.go:6400:13: undefined: excelize.ShowGridLines
.\myprogram.go:6401:13: undefined: excelize.ShowRowColHeaders
.\myprogram.go:6402:13: undefined: excelize.RightToLeft
.\myprogram.go:6402:13: too many errors


Pages in github:
GH/qax-os/excelize

GH/xuri/excelize
Redirects to GH/qax-os/excelize

GH/xuri/excelize/v2
does Not exist

GH/360EntSecGroup-Skylar/excelize
Redirects to GH/qax-os/excelize


I try a lot of commands
Some worked, and some failed, and I’m with with problem when try to use go run

go get GH/qax-os/excelize
go: GH/qax-os/excelize@v1.4.1: parsing go.mod:
module declares its path as: GH/360EntSecGroup-Skylar/excelize
but was required as: GH/qax-os/excelize

$ go get GH/360EntSecGroup-Skylar/excelize
go: downloading GH/360EntSecGroup-Skylar/excelize v1.4.1
go: downloading GH/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
go: added GH/360EntSecGroup-Skylar/excelize v1.4.1

$ go get GH/xuri/excelize
go: GH/xuri/excelize@v1.4.1: parsing go.mod:
module declares its path as: GH/360EntSecGroup-Skylar/excelize
but was required as: GH/xuri/excelize

$ go get GH/xuri/excelize/v2
go: downloading GH/xuri/excelize v1.4.1
go: downloading GH/xuri/excelize/v2 v2.7.1
go: downloading GH/richardlehane/mscfb v1.0.4
go: downloading GH/xuri/efp v0.0.0-20220603152613-6918739fd470
go: downloading GH/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22
go: downloading GOL/x/crypto v0.9.0
go: downloading GOL/x/net v0.10.0
go: downloading GOL/x/text v0.9.0
go: downloading GH/richardlehane/msoleps v1.0.3
go: upgraded GH/xuri/excelize/v2 v2.7.0 => v2.7.1

You have to use excelize v2.6.1 or earlier. 2.7.0 seems to have deprecated SetSheetViewOptions (maybe you can still use 2.7.0?) and 2.7.1 removed it.

1 Like

Thank you . Problem solved.

I am using last version and changed code because Excelize changed some function names and deprecated several things.

It’s working.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.