Convert KML to CSV in QGIS
How KML to CSV conversion in QGIS works, what it keeps and drops (geometry, styling, descriptions), and when CSV is the right output for your data.
Turning a KML file into a CSV in QGIS is a common step when placemarks from Google Earth or another mapping tool need to go into a spreadsheet, a database import or a reporting workflow. The conversion is straightforward, but it is not a neutral copy. KML is a spatial, styled, hierarchical format, and CSV is flat delimited text. This review explains what the conversion changes, when the result is fit for purpose and where a different output format serves better. No version-specific test results or measured outputs were supplied for this article, so the guidance relies on documented QGIS and GDAL behavior. Menu labels can differ slightly between QGIS releases.
Is CSV the right output for your use?
CSV is a good fit when you mainly need the attribute data, meaning names, descriptions and any custom fields, plus a simple location for each feature. It opens in almost any spreadsheet, database or scripting tool, and it is easy to inspect, sort and edit. That is the main benefit.
The decisive tradeoff is geometry and presentation. Point locations convert cleanly into X and Y columns. Lines and polygons can only be carried as long text strings, usually Well-Known Text (WKT). Those strings are hard to read and awkward to edit by hand, and spreadsheet software can handle them badly. Styling such as icon choice, colors and line widths is not kept at all, and neither is the folder structure of the KML.
A bounded recommendation: use CSV for point data or attribute tables destined for non-GIS tools. If the data will be edited or mapped again in GIS software, or if it contains lines and polygons you care about, save to a spatial format such as GeoPackage instead. You can still export a CSV copy for the spreadsheet audience.
What the conversion actually changes
Converting KML to CSV changes the stored structure of the data, not just how it looks. QGIS reads the KML through the GDAL library and writes a new text file in which each feature becomes one row and each attribute becomes one column. Several things happen along the way.
- Geometry is serialized into columns or text. With the X/Y option, a point's longitude and latitude become two numeric columns. With the WKT option, any geometry becomes a single text value such as POINT, LINESTRING or POLYGON followed by coordinate lists.
- Styling is dropped. KML styles, icons, colors and label settings have no place in a CSV and are not exported.
- Folder hierarchy is flattened or split. A KML with several folders or layers is often presented in QGIS as separate sublayers, and each one is exported on its own unless you merge them first.
- Standard KML properties become ordinary fields. Depending on the driver in use, columns such as Name, description, timestamp, altitudeMode, tessellate, extrude and visibility may appear.
- ExtendedData may become fields. Custom data stored as KML ExtendedData is typically exposed as attribute columns, which then export as normal CSV columns.
- HTML descriptions stay as raw text. Many KML files, especially Google Earth exports, store attribute tables as HTML inside the description. QGIS does not parse that HTML into separate columns, so the CSV cell contains the markup as-is.
The coordinate reference system matters too. KML coordinates are longitude and latitude on WGS 84 (EPSG:4326). If you choose a different CRS in the export dialog, QGIS reprojects the coordinates before writing them. That is useful for local projected systems, but the CSV itself carries no CRS information, so record the CRS somewhere alongside the file.
How to convert KML to CSV in QGIS
- Load the KML through Layer > Add Layer > Add Vector Layer, or drag the file into the QGIS window. If a sublayer selection dialog appears, choose the folders or layers you need.
- Check the attribute table first. Confirm which fields exist and whether useful data is buried inside the description field.
- Right-click the layer and choose Export > Save Features As.
- Set Format to Comma Separated Value [CSV] and choose a file name.
- Pick the CRS. Leave it as EPSG:4326 to keep plain longitude and latitude, or choose another system if downstream users expect it.
- Under Layer Options, set GEOMETRY. Use AS_XY for points, AS_XYZ if elevation values matter, or AS_WKT for lines, polygons or mixed geometry.
- Set SEPARATOR if needed. Comma is the default, and semicolon or tab may suit tools or regions where commas cause trouble.
- Check the encoding (UTF-8 is the usual choice) and select only the fields you need, then save.
If you want coordinates as regular attribute fields regardless of the export options, the Add Geometry Attributes processing tool, or the field calculator with expressions such as $x and $y for points, can add them to the layer before export. For batch or scripted work, the same GDAL conversion is available from the command line:
ogr2ogr -f CSV output.csv input.kml -lco GEOMETRY=AS_WKT
Replace AS_WKT with AS_XY for point-only data. If the KML contains several layers, ogr2ogr may need a layer name argument or may write one file per layer, depending on the GDAL version. Check the output before relying on it.
Choosing a geometry option
| Option | Best for | What you get | Main limitation |
| AS_XY | Point placemarks | Separate X and Y numeric columns | Not usable for lines or polygons |
| AS_XYZ | Points with elevation | X, Y and Z columns | Z is only meaningful if the KML stored altitude |
| AS_WKT | Lines, polygons, mixed data | One text column holding the full geometry | Long, hard-to-read strings that spreadsheets may mishandle |
| No geometry | Attribute-only reports | Fields only, no location | Location is lost entirely |
Will the CSV stay readable and usable after sharing?
CSV is plain text, so it copies, emails and versions well, and assistive technology that handles spreadsheets can generally read it as an ordinary table. The practical limits come from content and destination, not from the format itself.
- Spreadsheet encoding. Some versions of Microsoft Excel misread UTF-8 files without a byte order mark, which garbles accented or non-Latin names. The GDAL CSV driver offers a WRITE_BOM layer option for this. Alternatively, import the file through the spreadsheet's text import tool and specify UTF-8.
- Delimiter conflicts. Descriptions often contain commas, quotes and line breaks. A correct CSV quotes these, but simple tools that split on commas can break rows apart. A tab or semicolon separator can reduce problems with such tools.
- WKT length. Detailed polygons produce very long WKT strings. Excel imposes a documented maximum number of characters per cell, and longer geometries can be truncated without warning, which corrupts them. Keep complex geometry in a spatial format if exact shapes matter.
- Coordinate precision and formatting. Spreadsheets may reformat or round long decimal coordinates on display or save. Re-saving a CSV from a spreadsheet can quietly reduce precision.
- HTML in descriptions. Markup inside the description field is noisy for readers and screen reader users. It is also hard to search or filter. Extract the useful values into proper columns before export, or drop the field if it adds nothing.
- No CRS metadata. A recipient sees numbers, not a coordinate system. Name the CRS in the file name, a header note or accompanying documentation.
Beyond these documented behaviors, no destination-specific testing was available for this review. Verify the result in the actual tool your recipients use before treating the file as final.
When to keep a spatial format instead
A CSV is the right deliverable when people need to read, sort or import attribute values and point locations. It is the wrong one when the data needs to stay faithful as geometry, keep its styling or round-trip back into GIS without loss. In those cases, keep the master copy in GeoPackage or the original KML, and treat the CSV as a derived, simplified view rather than a replacement.