I'm importing Excel (.xlsx) files to postgres using the QGIS DB Manager "Import Layer/File..." tool. I've already successfully uploaded very similar Excel files without issue, but for one file in particular, DB Manager is ignoring the column headers and instead populating them as the first row of data instead of as the headers.

I have already looked for extra spaces and special characters, and the headers are in good shape.

  • 3
    I don't have an answer for you but xlsx headers can be pretty fickle even when you think it's fine. Sometimes I drag very similar sheets into QGIS and one has its headers detected properly while the other doesn't. I can't always figure out why. Have you tried formatting the data as a table in Excel and saving that? Removing all formatting? Maybe ensuring that the first column is numeric (if possible?) Deleted all empty rows and columns (which is not always straightforward)? (I would recommend an addon like ASAP Utilities to make data cleaning a lot easier) – she_weeds Apr 14 at 2:02
  • 2
    I don't know why it happens, my solution was to export the xxx file as csv – Leo Cardona Apr 14 at 2:48
  • My colleague and I have tried so many things at this point. It's bizarre. She even noticed that the field lengths in postgres are limited to 63 characters (and one of the field names was 68). I edited all field names to be under the limit, almost positive that would solve the problem, and it still hasn't. – Kristen G. Apr 20 at 15:17

Your Answer

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

Browse other questions tagged or ask your own question.