I want to copy and paste (or export) data from a query (or attribute table) into excel.

I've tried copying and pasting direct from a query results (in DB Manager) or loaded the query result as a layer, and done the same from the attribute table.

But in excel, if there is a linefeed or carriage return character (or both) in any cell of the query results, this gets split across multiple rows in excel.

Is there a way to control or avoid this behaviour?

  • 2
    In the attribute table right click Select All (or a selection) and 'Copy Cell Content' works. Paste into Notepad and remove the returns before excel.
    – Mapperz
    Nov 4, 2020 at 19:57
  • 2
    I get the same, I suggest the behaviour of copy and paste from the attribute table has changed from a few years ago (where CRs did not interfere). At the moment I workaround by right clicking on the layer and using Exporting Features as XLXS . I note, I don't get that with query tables in DBMan, these copy and paste OK in my experience.
    – BJW
    Nov 4, 2020 at 22:02
  • 3
    Right click on the layer with the selection -> export -> Save selected feature as.. -> and choose the format Ms Office Excel Nov 4, 2020 at 22:08
  • 1
    Do you have pandas python module installed? (import pandas)
    – BERA
    Nov 5, 2020 at 8:29
  • What is pandas python? I can't find it in plug ins. What does it do?
    – Oisin
    Nov 7, 2020 at 13:04


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.