2

I'm importing multiple excel files into QGIS (version 2.18.7) by dragging and dropping them into QGIS. The excel files don't contain any coordinates but data that I need to join to vector layers.

My problem is, that sometimes, seemingly at random, QGIS chooses not to use the entries in the first row as the field names. Instead the attribute table labels the field field 1, field 2 and so on. I guess I could save all the excel files as CSV files but I'd prefer not to add an additional step.

Is there some setting or import method that I'm missing?

  • Is there any pattern? What does the first cell contain in files that work and those that don't? Are they all in the same excel format? – lynxlynxlynx Mar 6 '18 at 14:25
  • 3
    Try importing those files who are "faulty" via the "add text file" dialogue, there are a lot more possible settings there. – Erik Mar 6 '18 at 14:27
  • @ErikLohmann, you should expand your comment into an answer. It's clear and succinct. – JoshC Mar 6 '18 at 15:12
  • I am kind of doing the same task discussed in this post: I get multiple (.xls, *.xlsx) files, which I need to process in QGIS Bonn to export in ASCii files. I would like to automate the process by using GDAL 2.2. Therefore, I am trying to use ogr2ogr to convert files from *.xlsx to a sort of vector file (.shp), and then to add a specific projection (EPSG:28354). Perhaps, this approach is wrong, I am very new in GDAL/Python, and that's why so far I cannot run a simple line. I am trying to find a guideline in gdal.org/gdal_utilities.html and qgis.org/en/site/forusers/in – Cristo Facundo Pérez Aug 2 '18 at 10:25
  • See also (same question really): gis.stackexchange.com/questions/203954/… – Rostranimin Aug 10 '18 at 15:07
2

Unfortunately, I believe the extra step to export the Excel file to a .csv file will be necessary.

There have been issues with regards to importing Microsoft Office files in various GIS packages. A lot of this can be due to the drivers for 64 bit operating systems.

It may be worth the experiment to see if what you are attempting will work in a 32 bit version of the operating system.

The one nice thing with exporting a .csv file is the ability to set up a watch file during the text file import, then any changes made to the text file will be reflected in the joined data without having to recreate the join within QGIS.

2

A possible, yet a bit more work-intensive solution is to load those "faulty" files via the "add text dialogue" into Qgis. The dialogue offers a lot of settings which might solve your problem, e.g. setting the coding of the file, the separators or header rows which are to be omitted.

  • As far as I can tell the add text doesn't work with .xlsx and .xls files. – DriveThomas Mar 7 '18 at 8:24
  • I could have sworn it worked for me two days ago... but you're right. – Erik Mar 7 '18 at 8:56

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.