2

I need to import a xls / xlsx / ods into QGIS. But while the first row (field names) of my XLSX in LibreOffice shows up on the first place as it should, QGIS shows the first row on place 452! As you can see in the screenshot below. I imported the XLSX to QGIS simply by drag'n'drop.

This issue seems to be very strange, because every program I tried, finds the row with field names on the first place! Also saving the XLSX to CSV results in the expected order: first row = field names (second screenshot). I tried saving and copying in all directions and variants - but QGIS still don't finds the field names on row 1.

Limitations:

  • I can not go for csv or any other format (just for testing)
  • the imported table need to be editable in QGIS.
  • The plugin "spreadsheet layers" is also not helping, because it uses virtual tables.
  • I can't share the data because there is a copyright.

enter image description here

enter image description here

7
  • 1
    Can you provide a screenshot of the import-dialogue? – Erik Apr 6 '20 at 7:32
  • @erik there is no import dialogue opening ods or xls as a vector layer. – Zoltan Apr 6 '20 at 7:45
  • Then maybe OP should clarify how exactly they import the data. – Erik Apr 6 '20 at 7:48
  • @MAP, I made a quick test with an ods file, the single row header was parsed well, I saved the file to xlsx and the header was used from field names in QGIS. Multiline headers are not handled by QGIS. – Zoltan Apr 6 '20 at 8:01
  • Maybe the headers are corrupted, could you try saving as CSV then saving back to XLSX and see if that works (you'll lose your formatting but if you want to edit an xlsx in QGIS you'll probably lose your formatting anyway). – she_weeds Apr 6 '20 at 9:32
1

4h of testing and trying! Nothing of the following helped:

  1. Changing char set and language,
  2. tried several delimiters,
  3. reduced word length, delete all formatting and special characters
  4. saving from XLSX to CSV and back,
  5. import in QGIS as CSV and export it as XLSX

But: Importing the CSV into a Database like SpatiaLite or GPKG and exporting back to XLSX was solving the problem!


2
  • Which qgis version were u referring to ? i'm currently playing with the 3.10 and i had the same problem. I have both libre office and open office installed. my spreasdheet was originally created in Libre office with this weird behaviour (ods file) in qgis. Once opened and modified in Open Office the problem disappeared. there must be a difference between the two suites ... – Snaileater Dec 2 '20 at 18:03
  • Can't really remember... Must have been QGIS 3.4 or 3.8 – MAP Dec 2 '20 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.