45

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 '15 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 '15 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 '15 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 '15 at 20:33
72

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
  • Yes, but I want it for free. To get XYtools you need to pay. Is there any other way?
    – Po Po
    Feb 18 '15 at 14:22
  • 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 '15 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 '15 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 '15 at 16:09
  • 1
    @gcarrillo Thank you. Yes, now it's working. Thank you a lot.
    – Po Po
    Feb 18 '15 at 20:43
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 '15 at 14:24
  • 1
    "Comma Separated Value [CSV]" third option from the top. Feb 18 '15 at 14:47
  • Thanks, but now it's not working. I cann't open the file in Excel.
    – Po Po
    Feb 18 '15 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 '16 at 0:04
11

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

Attributes Export to CSV File

MMQGIS Attributes Export to CSV File

11

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 '19 at 16:18
4
  1. Select rows
  2. Copy selected rows to clipboard
  3. Paste in Excel

enter image description here

2
  • 3
    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.
    – johns
    Feb 3 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 at 1:57
3

From QGIS 3.18, you can use "Export to spreadsheet" algorithm available in Processing Toolbox. 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

1
  • Should be using this instead of other ways. Apr 24 at 5:17
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, privacy policy and cookie policy

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