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

When using GetSheetMap(), the result map only contain last sheet #297

Closed
mrdundun opened this issue Nov 19, 2018 · 0 comments
Closed

When using GetSheetMap(), the result map only contain last sheet #297

mrdundun opened this issue Nov 19, 2018 · 0 comments

Comments

@mrdundun
Copy link

When using GetSheetMap(), the result map only contain last sheet

When I parse xlsx file by using GetSheetMap(), the result map only contain one sheet(the last sheet).But actually there are about 70 sheets.

when I debug into the implement of GetSheetMap(), I found that err occurs here:

rID, _ := strconv.Atoi(strings.TrimSuffix(strings.TrimPrefix(rel.Target, "worksheets/sheet"), ".xml"))

The value of rel.Target is "/xl/worksheets/sheet1.xml", and convert failed.
The value of rID always be "0".The next sheet always replace the previous.
I thing that's why the result map only contain the last sheet.

Steps to reproduce the issue:

        xlsx, err := excelize.OpenFile("./1.xlsx")
	if err != nil {
		fmt.Println(err)
		return false
	}

	for index, name := range xlsx.GetSheetMap() {
		fmt.Println(index, name)
	}

Output of go version:

go version go1.9.2 darwin/amd64

Excelize version or commit ID:

1.4 

Environment details (OS, Microsoft Excel™ version, physical, etc.):
Mac OS 10.13.6
1.xlsx

@xuri xuri added confirmed This issue can be reproduced in progress Working in progress labels Nov 21, 2018
taomin597715379 pushed a commit to taomin597715379/excelize that referenced this issue Nov 24, 2018
Change-Id: If5ee122b05041f8c7b6ea4c7e8a8a412e74d71b8
@xuri xuri closed this as completed in 1bb59f7 Nov 24, 2018
xuri added a commit that referenced this issue Nov 24, 2018
@xuri xuri removed confirmed This issue can be reproduced in progress Working in progress labels Nov 24, 2018
nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
Change-Id: I585a4a017867b89bd39cb6e711467a46eaa757be
nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
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

2 participants