# KML to CSV converter

> Get the places from a Google Earth or Google My Maps file as a spreadsheet: one row per placemark, with latitude, longitude and every field. Opens in Excel and Google Sheets. Free, and no account needed.

Open the tool: https://spatibase.com/tools/kml-to-csv/

The Spatibase KML to CSV converter turns a KML or KMZ file into a CSV table in your web browser. What you get:

- **One row per placemark.** Each row holds the `name`, the `description` as plain text, the `folder`, every ExtendedData field, `latitude` and `longitude` for points, and a `wkt` column with the shape of every point, line and area.
- **Made for spreadsheets.** The file is UTF-8 with a byte order mark, so Excel shows accents correctly, and styles and icons are left out.
- **Never uploaded.** Your file is read on your computer. Files up to 50 MB work, with no account.

## What it does
- Convert KML and KMZ files to CSV
- One row per placemark, from every folder
- Separate latitude and longitude columns for points
- Lines and areas as WKT, which QGIS, PostGIS and BigQuery read
- Keeps names, plain-text descriptions, folders and ExtendedData fields
- UTF-8 with a byte order mark, so Excel shows accents correctly
- Runs in the browser: nothing is uploaded

## How to convert KML to CSV
1. Export the map. In Google My Maps, use the menu next to the map’s title → Export to KML/KMZ (pick one layer or the whole map). In Google Earth Pro, right-click a folder in Places → Save Place As.
2. Drop the .kml or .kmz on the box above, or press Choose a file.
3. Look over the map and the list under it: each place there becomes a row in the CSV.
4. Press Download CSV.
5. Open it in Excel with a double-click, or in Google Sheets with File → Import → Upload.

## Formats and limits
- **Opens:** .kml or .kmz, up to 50 MB. Other map files (KML, KMZ, GPX, GeoJSON, shapefile, CSV) convert too.
- **Downloads:** CSV, GeoJSON of the same features.
- **Privacy:** the file is read in your browser and never uploaded.
- Try it with a sample: https://spatibase.com/tools/kml-to-csv/?sample=1
- Download the sample file (the one Open a sample opens): https://spatibase.com/tools/samples/barcelona.kml

## Which KML data ends up in the CSV
| What | What happens |
|---|---|
| Placemarks | One row each, from every folder, in the order of the file. |
| Name | The `name` column, first in the table. |
| Description | The `description` column, as plain text. HTML tags are removed; line breaks stay inside the cell. |
| Folder | The `folder` column. Nested folders read like `Trip / Day 2`. |
| ExtendedData fields | One column per field. A placemark without that field gets an empty cell. |
| Point coordinates | `latitude` and `longitude` columns in decimal degrees, latitude first. |
| Lines and areas | Their full shape in the `wkt` column, such as `LINESTRING (2.17 41.38, 2.18 41.37)`. Their latitude and longitude cells stay empty. |
| Altitude | Dropped. The WKT holds longitude and latitude only. |
| Styles, icons, overlays | Left out. Image overlays and network links are counted in the notes. |

## From KML to a spreadsheet: latitude, longitude and WKT
**KML hides the coordinates in one tag.** Inside a KML, a pin is stored as `2.174356,41.403629,0`: longitude, latitude and altitude in a single `<coordinates>` text. Copying that into a sheet by hand means splitting it and swapping the order.

The CSV splits them for you:

- **Points get two columns.** A `latitude` and a `longitude`, latitude first, the way Google Maps and most people write them. You can sort, filter or paste them into another tool.
- **Lines and areas go into wkt.** A path or a boundary doesn’t fit in two columns, so its shape is written as WKT (Well-Known Text). QGIS, PostGIS, BigQuery and Google My Maps can turn that column back into shapes.
- **Everything in one file.** Folders don’t split the output: all placemarks land in one table, and the `folder` column tells you where each came from. Filter on it to get one folder.

**Excel shows one column?** Excel set to a European language expects semicolons. Open the CSV with Data → From Text/CSV instead and choose Comma as the delimiter.

## Convert KML to CSV with ogr2ogr
With GDAL installed (QGIS includes it), one command writes the CSV. The `GEOMETRY` option decides how the location is stored:

```bash
# points: X (longitude) and Y (latitude) columns
ogr2ogr -f CSV out/ places.kml -lco GEOMETRY=AS_XY

# any shape: a WKT column
ogr2ogr -f CSV out/ places.kml -lco GEOMETRY=AS_WKT
```

**How the result differs from this page:** ogr2ogr writes one CSV per KML folder, puts longitude (`X`) before latitude (`Y`), keeps descriptions as HTML and adds KML settings such as `tessellate` and `visibility` as columns.

**In JavaScript,** `@tmcw/togeojson` reads the KML into GeoJSON; each feature’s properties plus its coordinates then make one row.

## Frequently asked questions
### How do I get the coordinates from a KML file into Excel?
Convert it here and open the CSV. Every point has its own latitude and longitude columns in decimal degrees, next to its name, description and fields. Lines and areas have their shape in the wkt column instead.

### Can Excel open a KML file directly?
Only as raw XML. Excel can load a .kml as an XML table, but the coordinates stay one text value per placemark, with longitude, latitude and altitude run together. A CSV from this page gives clean latitude and longitude columns.

### Why are latitude and longitude empty for some rows?
Those rows are lines or areas, which have many coordinates rather than one. Their whole shape is in the wkt column, which QGIS, PostGIS and Google My Maps can read.

### How do I export Google My Maps to Excel?
My Maps exports KML or KMZ, not spreadsheets. Use Export to KML/KMZ from the map’s menu, drop the file here and press Download CSV. The columns you imported into My Maps come back as columns.

### Does it convert KMZ files to CSV too?
Yes. A KMZ is a zipped KML, and the converter unzips it first. Photos and icons inside the KMZ are not part of the CSV.

### Is my KML sent to a server?
No. The conversion runs in your browser, on your computer, and the file is never uploaded to Spatibase or anyone else. Only the background map loads from the internet.

## Next step
Turn the file into a live map your team can edit: **Save to Spatibase (free)** on the page saves it to a free Spatibase project (https://app.spatibase.com/signup), your places on a map you can edit and a live GeoJSON address for your site. Or download the GeoJSON and import it by hand (https://spatibase.com/docs/content/import/).
