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

Deleting sheets not working correctly #834

Closed
KaareKristensen opened this issue May 4, 2021 · 1 comment
Closed

Deleting sheets not working correctly #834

KaareKristensen opened this issue May 4, 2021 · 1 comment
Labels
confirmed This issue can be reproduced

Comments

@KaareKristensen
Copy link

Description
I have some code that opens a file and deletes all sheets apart from a single sheet. The code then creates more sheets and populates them with data using file.SetCellValue. If the code created the file itself it does not work, if I created the file and the code then edits it then it does work.
The problem is that when I open the file in Excel I get an error and Excel tries to repair the file. The inserted data is gone after the repair.

Steps to reproduce the issue:
temp.zip

  1. Run the included code to create a file
  2. Run the code again to "edit" the file, although it just sets the same values in all cells
  3. Open the edited file in excel

Describe the results you received:
Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.
Replaced Part: /xl/worksheets/sheet2.xml part with XML error. Declared prefix. Line 2, column 143.
Replaced Part: /xl/worksheets/sheet3.xml part with XML error. Declared prefix. Line 2, column 143.

Note that I have not created a sheet by these names.

Describe the results you expected:
I expected to see the new sheets with the new data and no error message.

Output of go version:

go version go1.15 windows/amd64

Excelize version or commit ID:

v2.4.0

Environment details (OS, Microsoft Excel™ version, physical, etc.):

Windows 10
Excel version: 16.0 (Microsoft 365)

@xuri xuri added the confirmed This issue can be reproduced label May 6, 2021
@xuri xuri closed this as completed in 438fd4b May 6, 2021
@xuri
Copy link
Member

xuri commented May 6, 2021

Thanks for your feedback, I have fixed it, please try to use the master branch code, and this patch will be released in the next version.

jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed This issue can be reproduced
Projects
None yet
Development

No branches or pull requests

2 participants