QGIS is great for analyzing spatial data but it’s often easier to export layer attributes for additional analysis in a program like Excel or R. To do that you need to export the data from a layer’s attribute table to a format that is readable by other programs.
To export a QGIS attribute table as an Excel spreadsheet or other format right-click the layer name in the Layers (Table of Contents) panel, hover over the ‘Export’ option, then select ‘Save Features As’. From the ‘Save Features As’ window you can export a layer from QGIS to another format, including Excel spreadsheet, CSV, and other machine-readable formats.
This tutorial will demonstrate, with visuals, how to export an attribute table from QGIS. For more QGIS tutorials that include practice data check out the QGIS for Beginners course.
Import a Vector Layer Into QGIS
To start, you’ll need a vector layer with attributes that you can export. For this example, I’m using a shapefile of the United States that includes population estimates and other population data for the years 2010-2019. This same file is available for students registered for the QGIS for Beginners course. You can use any vector layer that has attributes associated with the spatial data.
Open the Layer’s Attribute Table
Once you have the layer loaded it’s a good idea to open up the attribute table to see what the attribute data look like. Open the QGIS attribute table by right-clicking on the layer name in the Layers (Table of Contents) panel then select ‘Open Attribute Table’.
You now see a table similar to the one below. The attribute table shows the data associated with each geographic feature. These are the data we want to export for further analysis. None of the tools in the QGIS attribute table toolbar allow you to export the table. We’ll do this from the main QGIS interface.
Save an Attribute Table as an Excel Spreadsheet
It is simple to export the shapefile attribute table from QGIS to another format. In the Layers (Table of Contents) panel, left-click once to select the layer you wish to export. The layer name will now be highlighted in blue. Now right click on the layer name to bring up additional options. Hover over the ‘Export’ option and an additional menu will appear. From the export options select ‘Save Features As.’
If you have selected specific features you can export only the selected features by choosing the ‘Save Selected Features As’ from the export options.
After you click ‘Save Features As’ a new dialog (window) will appear. In this dialog you will specify the information and options to export the attribue table.
First, select a file format from the ‘Format’ drop-down (see image below). To get a file that can be opened in Microsoft Excel you should choose one of the ‘MS Office Open XML spreadsheet [XLSX]’ or ‘Comma Separated Values [CSV]’ options.
The XLSX format will produce a native Excel document. CSV format will produce a text file that is readable by Excel and other programs like Libre Office (there is also an ‘Open Document Spreadsheet [ODS]’), Google Sheets, and R. CSV files can be opened in Excel and then saved to XLSX format.
Next click the ellipsis (three dots, . . .) button next to select the file name to save.
You don’t need to make any other changes. If you click the ‘OK’ button the attribute table will be saved in the specified format to the specified location.
However, you can still make a few adjustments to customize the file contents. The most important is selecting the fields (columns) that you want to export. If your shapefile has many columns you might not want to export all of them. You can control which fields are exported by selecting or deselecting the check box next to individual fields.
You can also prevent QGIS from adding the exported file to the map by deselecting the ‘Add saved file to map’ check box next to the ‘OK’ button.
When you have specified all the appropriate settings click ‘OK’ and the new file will be created and saved.
Save a QGIS Attribute Table to Other Formats
With this same process you can export a vector layer or a vector layer attribute table from QGIS to many other formats. The complete list of formats is shown from the ‘Format’ drop-down menu in the ‘Save Features As’ dialog.
Other tabular formats include SQLite and Postgre SQL database compatible files along with the aforementioned Open Document Spreadsheet format for Libre Office and other open source office software.
You can use this same method to change the coordinate reference system (CRS) of a vector layer or convert a vector layer from shapefile format to KML (Google Earth), SpatialLite, GeoPackage, or other spatial formats.
Exporting shapefile attributes makes it possible to perform more sophisticated analyses outside of QGIS and then join the results back to features’ geographic data for display. Know how to export data from vector attribute tables is a skill every GIS analyst and geographer should have. It will greatly increase your analytical and data display capabilities.
My Recommended Equipment
Computer: Dell XPS
External Hard Drive: Seagate Portable 2TB
This article contains affiliate links. When you click on links in this article Open Source Options may make a commission on any sales. This does not have any impact on the price you pay for products.