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

Export to spreadsheet creates an xlsx file with errors when exporting empty tables/layers #42945

Closed
kobusburger opened this issue Apr 26, 2021 · 10 comments
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@kobusburger
Copy link

Describe the bug
The "Export to spreadsheet" algorithm creates an xlsx file with errors depending in the layers that are selected. Some layers do not create the error and others do. The errors can be verified the attached files:
Export test.qgz
Export test.gpkg
error107520_04.xml
Export test.xlsx

How to Reproduce

  1. Run "Export to spreadsheet"
  2. Select layers, select output file and run (accept the defaults for the check boxes)
  3. The algorithm completes without errors
  4. Excel gives an error when the xlsx file is opened

QGIS and OS versions

QGIS version 3.18.2-Zürich QGIS code revision 515138c
Compiled against Qt 5.11.2 Running against Qt 5.11.2
Compiled against GDAL/OGR 3.1.4 Running against GDAL/OGR 3.1.4
Compiled against GEOS 3.8.1-CAPI-1.13.3 Running against GEOS 3.8.1-CAPI-1.13.3
Compiled against SQLite 3.29.0 Running against SQLite 3.29.0
PostgreSQL Client Version 11.5 SpatiaLite Version 4.3.0
QWT Version 6.1.3 QScintilla2 Version 2.10.8
Compiled against PROJ 6.3.2 Running against PROJ Rel. 6.3.2, May 1st, 2020
OS Version Windows 10 (10.0)
Active python plugins firstaid; kmltools; NNJoin; plugin_reloader; refFunctions; SpreadsheetLayers; db_manager; MetaSearch; processing

Additional context
Export error test.zip

@kobusburger kobusburger added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Apr 26, 2021
@gioman gioman added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Apr 26, 2021
@gioman
Copy link
Contributor

gioman commented Apr 26, 2021

Additional context
Export error test.zip

@kobusburger gpkg datasource is missing in your zip

Screenshot_20210426_104254

@gioman gioman added the Feedback Waiting on the submitter for answers label Apr 26, 2021
@kobusburger
Copy link
Author

kobusburger commented Apr 26, 2021 via email

@kobusburger
Copy link
Author

Export error test.zip
gpkg is now included in the zip

@gioman
Copy link
Contributor

gioman commented Apr 26, 2021

Export error test.zip
gpkg is now included in the zip

@kobusburger output opens fine in LibreOffice Calc, cannot test on Excel as I don't own any copy of MS Office.

@kobusburger
Copy link
Author

Also note that "Export to spreadsheet" sometimes does not export all the selected layers (depending on the selection). This can confirmed by opening the xlsx in 7-Zip.

@gioman gioman removed the Feedback Waiting on the submitter for answers label Apr 26, 2021
@FelisPimeja
Copy link
Contributor

FelisPimeja commented Apr 26, 2021

I can confirm the bug with test dataset in Excel 365 on Windows 10 x64.

The bug seems somehow related with exporting empty tables.

  • If you export one empty table - it's OK.
  • When you export several tables including empty one and that empty table is in the end of queue (- > and last spreadsheet in excel file) - it's OK.
  • When you export several tables including empty one and that empty table is NOT in the end of queue - resulting XLSX is corrupted.

If I add a row to the empty table the bug also dissapears.
Have no skills to investigate further ).

@gioman gioman changed the title Export to spreadsheet creates an xlsx file with errors Export to spreadsheet creates an xlsx file with errors when exporting empty tables/layers Apr 26, 2021
@Pedro-Murteira
Copy link

Still valid on QGIS 3.22.4 and 3.24.0. Tested with both "MS Office Excel" and "LibreOffice Calc".

@alexbruy
Copy link
Contributor

@rouault does this ring a bell for you?

@rouault rouault self-assigned this Sep 27, 2023
@rouault
Copy link
Contributor

rouault commented Oct 2, 2023

Could someone confirm that test.xlsx can be opened fine with Excel 365 / MS office ?

@alexbruy
Copy link
Contributor

alexbruy commented Oct 3, 2023

@rouault I tried to open it using Office 2016 and it opens fine.

rouault added a commit to OSGeo/gdal that referenced this issue Oct 3, 2023
XLSX: do not write empty <cols> element on empty layers, and change heuristics to detect 'default' empty layers from intended empty ones (fixes qgis/QGIS#42945)
rouault added a commit to OSGeo/gdal that referenced this issue Oct 3, 2023
…euristics to detect 'default' empty layers from intended empty ones (fixes qgis/QGIS#42945)
rouault added a commit to OSGeo/gdal that referenced this issue Oct 3, 2023
[Backport release/3.7] XLSX: do not write empty <cols> element on empty layers, and change heuristics to detect 'default' empty layers from intended empty ones (fixes qgis/QGIS#42945)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

6 participants