30

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?

  • What method have you tried for copy-paste into Excel? – Simbamangu Feb 18 '15 at 14:13
  • 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
  • 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
  • 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
54

UPDATE 13.10.2016:

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].

I'm using QGIS v.2.14.4


PREVIOUS ANSWER (still 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.

  • 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. – Germán Carrillo 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. – Germán Carrillo 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. – Germán Carrillo 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
26

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.

  • 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. – HeikkiVesanto 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
8

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

5

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
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.

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.