4

How can I export a layer to Excel format in QGIS environment and have alias of the fields in the header of the Excel file instead of the original field names?

5
  • Question edited by the community. A PyQGIS solution is still acceptable.
    – RandyO
    Feb 2, 2022 at 7:25
  • 1
    Use 'Export to spreadsheet' algorithm from the Processing Toolbox and tick the checkbox to 'Use field aliases as column headings' ??
    – Ben W
    Feb 3, 2022 at 2:58
  • @BenW I think this should be the answer.
    – RandyO
    Feb 3, 2022 at 6:40
  • So it worked ok with Arabic & Farsi aliases? If so, great- I will post it as an answer.
    – Ben W
    Feb 3, 2022 at 6:44
  • 1
    @BenW yes. no problem.
    – RandyO
    Feb 3, 2022 at 17:09

2 Answers 2

7

You could use the "refactor fields" algorithm from the processing toolbox to create fields with the alias as name and fill them using the original field name as source. This lets you manually define the field names for the exported dataset.

You can then export this algorithm as script and use python to generate the configuration for the fields.

Save features as

Since QGIS 3.26 it's possible with the "save features as" functionality, right click on a vector layer.

enter image description here

3
  • Faced an issue when working with Refactor Fields. Encoding problem with Name. Currently the aliases are Arabic or Farsi which it chooses the original name in this case.
    – RandyO
    Feb 2, 2022 at 7:09
  • BTW this creates a new Layer which makes the whole process complicated.
    – RandyO
    Feb 2, 2022 at 7:09
  • 1
    The functionality was introduced in the standard vector layer export dialog since QGIS 3.26.0. Jan 29, 2023 at 14:52
5

You can use the processing algorithm 'Export to spreadsheet' from the Processing Toolbox and tick the checkbox to 'Use field aliases as column headings'.

enter image description here

Your Answer

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

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