48

I have seen all the questions for how to export an attribute table to Excel from QGIS, and I try all the answers like copy paste, CSV (in fact this I do not know where to find), but none seems to be the right answer.

Can anyone help me?

4
  • 1
    What method have you tried for copy-paste into Excel?
    – Simbamangu
    Feb 18, 2015 at 14:13
  • 1
    Siple copy-paste. Select all the feature, copy, open excel, select more then my feature cloumns, rows and paste. Am I right?
    – Po Po
    Feb 18, 2015 at 15:07
  • 1
    Yes, select-all then copy, but don't try to select the range of cells within Excel, paste into a single cell. What error did you get?
    – Simbamangu
    Feb 18, 2015 at 19:25
  • 1
    Many rows with a long number. In some cells the information is missing. Looks like it is not the right way? Shuold have another way that give you the column and the rows like they are in your attribute table.
    – Po Po
    Feb 18, 2015 at 20:33

8 Answers 8

77

QGIS v3.x

Right click on the layer in the Table of Contents (aka. legend or layer tree) and open the Save As... dialog.

Once there, click on the Format option list and choose MS Office Open XML spreadsheet [XLSX].

Note that you also have an option for Libre Office files: Open Document spreadsheet [ODS].


ORIGINAL ANSWER (no longer valid):

  1. Install the XY Tools plugin by Richard Duivenvoorde.

  2. Select a vector file from the ToC (that is, make it active).

  3. Go to Vector->XY tools->Save attribute table as Excel file.

enter image description here

You would need the Python library xlw installed for doing so.

13
  • 2
    @PoPo You don't need to pay for using XY tools plugin, I myself use it. The author suggests you to donate 5€ if you use the plugin, but it's up to you to donate. Feb 18, 2015 at 14:23
  • 1
    @PoPo You can download the plugin from here or simply go to Plugins->Manage and Install plugins and search for xytools. Feb 18, 2015 at 14:27
  • 1
    @PoPo You can download it from the last link I gave you, delete your current xytools folder in USER/.qgis2/python/plugins/. Then extract the downloaded zip into that location. Restart QGIS and you're done. I see there were modifications to the file excel.py in the latest version, and I've used the previous one without problems. Feb 18, 2015 at 16:09
  • 1
    @gcarrillo Thank you. Yes, now it's working. Thank you a lot.
    – Po Po
    Feb 18, 2015 at 20:43
  • 1
    This answer is a little outdated, I found the answer below to be more current.
    – edge-case
    Nov 8, 2019 at 16:21
29

To get a csv file of the attribute table, rightclick on the layer in the legend, select Save As ..., and change the file format from shapefile to CSV.

You might need to change the separator from comma to semicolon in a text editor if Excel does not like the default separator.

4
  • Yes I try to do that but I din't find csv format file in my drop-down menu. Can you show an image, please.
    – Po Po
    Feb 18, 2015 at 14:24
  • 1
    "Comma Separated Value [CSV]" third option from the top. Feb 18, 2015 at 14:47
  • Thanks, but now it's not working. I cann't open the file in Excel.
    – Po Po
    Feb 18, 2015 at 15:59
  • 1
    This answer is more robust, because it works for other generic spreadsheet programs as well. CSV is easily opened in Excel through the Import Text wizard. You just need to specify "Text (CSV)" in the format
    – aaryno
    Jun 2, 2016 at 0:04
14

In QGIS versions 3 and above, the easiest way to export an attribute table is to:

  1. Right-click the attribute layer in the layers menu
  2. Select Export and Save features as...
  3. At the top of the program window, select Comma Separated Value [CSV] in the format drop-down menu
  4. Type a file name for the file to be saved
  5. Click the three-dot button ... next to the file name to choose a path to where the file should be saved
  6. Uncheck any fields you do not want in your resulting file
  7. Optionally (probably) uncheck the add saved file to map at the bottom of the window so that the file does not get added to your project as a data layer
  8. Click the green check mark, Ok button
1
  • This is the most recent and accurate answer for the more recent versions of QGIS. I'm using 3.4.11-Madeira and this worked for me.
    – edge-case
    Nov 8, 2019 at 16:18
12

There's also the MMQGIS Plugin which, when downloaded and installed from the toolbar (Plugins > Manage and Install Plugins...), has the tool:

MMQGIS > Import/Export > Attributes Export to CSV File

MMQGIS Attributes Export to CSV File

4
  1. Select rows
  2. Copy selected rows to clipboard
  3. Paste in Excel

enter image description here

3
  • 4
    This is my preferred method. I found it a bit annoying that the geometry field was copied as well until I discovered one can go to Settings - Data sources and change the Copy features dropdown to plain text, no geometry. I also find the fields & rows can be oddly sized for word wrapping in Excel, but if I expand the column width to some overly large size, I can then use the autofit fields and rows options in Excel to get a nice looking table.
    – John
    Feb 3, 2021 at 14:32
  • Most helpful. Here is what worked after many failures with a notice no copy was made. As johns suggested, I went to Settings - Data sources, and changed to plain text, no geometry. Then, instead of using Control+A to select the 16 features I had filtered to using an expression to filter out from about 20,000 features to the 16 I needed, I selected each row one at a time holding down the Control key (when I used Control + A to select all of the 16 features showing, I believe it tried to copy all 20,000+ features in the layer (not visible to me), which also happened with the export method).
    – JJD
    Jul 30, 2021 at 1:57
  • Keep in mind : this approach will also copy the hidden column "wkt_geom" with geometry!
    – Taras
    Mar 14, 2022 at 7:34
4

From QGIS 3.18 (see the Changelog), you can use the "Export to spreadsheet" algorithm available in the QGIS's Processing Toolbox (Ctrl+Alt+T).

It enables to export one or more layers in multiple sheets, to overwrite or append them to existing files. Output formats supported are Excel XLSX and Open Document Spreadsheet ('.ods')

Fine for exporting full layers, otherwise, keep using already mentioned methods in other answers when you need to export selected features to spreadsheet

Export to spreadsheet screen capture

4
  • Should be using this instead of other ways. Apr 24, 2021 at 5:17
  • Where is this found? I'm looking all through the processing toolbox with QGIS 3.18 but I cannot see how to bring this screen up!
    – Emu
    Oct 23, 2021 at 12:02
  • Ah I've found it but it's available from QGIS 3.20 on.
    – Emu
    Oct 23, 2021 at 14:33
  • According to the release notes, from 3.18 not 3.20 qgis.org/en/site/forusers/visualchangelog318/…
    – ThomasG77
    Oct 23, 2021 at 16:44
2

Export the layer as a shapefile, find the shapefile on your PC. Copy/Rename the filename of the DBF part of the shapefile exportes to be 8 or under characters if it's not. (OLD MS DOS FILENAME ISSUE). Then, drag-drop the DBF right into Excel.

Save as XLS.

The copy paste method right form QGIS made text/character returns in a blob reset to the next row and cause data problems in excel.

1

X/Y tools is regrettably no longer available in QGIS 3.x. There is another way how to export the attribute table to Excel, without any trouble concerning text encoding, column names and fields containing special characters in foreign languages like e.g. Vietnamese,. However, your input file should be in UTF-8 encoded:

  1. Right click on the shp file, Export, save features as Open Document Spreadsheet (ODS.
  2. Open the ODS file with LibreOffice or MS Excel.
  3. Save as Excel file (xls or xlsx)

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.

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