CSV import
Import database objects from a CSV file or from a remote CSV URL (including a published Google Sheet). MapSVG can detect columns, suggest missing fields, run large imports in the background, and optionally keep your map in sync when the remote file changes.
For a deeper dive into Google Sheets as a live data source, see the blog post Google Sheets auto-sync with maps.
Import sources
| Source | When to use |
|---|---|
| Upload file | One-off or repeated manual uploads from your computer. |
| Remote URL / Google Sheets | Paste a public CSV URL—most often File → Share → Publish to web → CSV from Google Sheets. Any reachable CSV URL works. |
Short summary of what the current workflow supports:
- Automatic column detection — Use Sync fields next to the file or URL input. Headers are read from the first row; columns not yet in your schema appear as suggestions you can add before importing.
- Schema assistance — Field types can be inferred from the CSV where possible (text, numbers, selects, dates, images, locations, etc.).
- ID column — Choose which CSV column identifies rows for matching existing records (upsert) vs. treating the sheet as a snapshot (when no stable ID is used with auto-refetch).
- Geocoding — For location columns, optional Google Geocoding: addresses ↔ coordinates, with controls for free-tier pacing vs. faster paid usage.
- Images — Remote image URLs in the CSV can be downloaded into the WordPress Media Library and attached to records (deduplicated by URL).
- Large files — Heavy imports are processed in batches via WP-Cron, which helps avoid timeouts and supports very large datasets (e.g. 100k+ rows).
- Google Sheets auto-sync (remote): After you connect a remote URL, MapSVG can periodically re-fetch the CSV in the background (WP-Cron). Your spreadsheet can stay the source of truth—update rows in Sheets and the site can refresh without re-uploading files.
Open the in-editor CSV format instructions link on the CSV tab for the same reference table shown below.
Before you start
- Header row: The first row must list column names that match your MapSVG field names exactly (same spelling and casing as in Database → Edit fields).
- Location fields: Set Database → Edit fields → Location → Language before importing addresses so geocoding uses the correct language.
Typical flow
- Open Database → CSV import (or your map’s CSV source tab).
- Choose Upload file or Remote URL / Google Sheets and provide the file or URL.
- Click Sync fields — review detected columns and add any suggested fields.
- Set options (ID column, geocoding, auto-refetch for remote sources, etc.).
- Use Continue / Save settings / Import now as shown in the UI.
- Use See logs if you need import history or troubleshooting.
Example spreadsheets
- With geocoding-related guidance in the UI: Example spreadsheet (with location)
- General example: Example spreadsheet
CSV field format reference
The following matches the CSV import instructions & field reference modal in the plugin.
| Field type | Example value | Notes |
|---|---|---|
| Text | Coffee Roasters | Stored as-is. |
| Number | 4.5 | Integer or decimal. Stored as-is. |
| Select, Radio, Status | 1 | Option value — stored directly. |
North | Option label — resolved to the matching value automatically. | |
| Invalid — must match an existing option value or label exactly. | ||
| Select (multiselect) | Coffee,Tea | Comma-separated list. Each token matched by value or label. |
Beer | Single value. | |
| Checkboxes | Wifi,Parking | Comma-separated list. Each token matched by value or label. |
Wifi | Single value. | |
| Checkbox | 1 / 0 | Checked / unchecked. |
true / false | Checked / unchecked (text form). | |
| Location | 40.7128,-74.0060 | lat,lng — valid range: ±90 lat, ±180 lng. |
Paris | Address — geocoded when Google Geocoding is enabled (~1,300 free requests/day tier; runs in the background). | |
Main st. 1, New York, USA | Address with commas — accepted. | |
| Invalid — coordinates outside valid range. | ||
| Regions | US-TX | Single region ID. |
US-TX,US-AL,US-NY | Multiple region IDs — comma-separated. | |
| Invalid — use commas between IDs, not spaces. | ||
| Post | 42 | WordPress post ID — verified to exist before storing. |
my-post-slug | Post slug — resolved to the post ID. | |
| Date / Datetime | 2024-06-15 | Date only (YYYY-MM-DD). |
2024-06-15 14:30:00 | Date and time (YYYY-MM-DD HH:MM:SS). | |
| Image | https://example.com/photo.jpg | Single remote URL — downloaded to the Media Library; same URL is not downloaded twice. |
https://example.com/a.jpg,https://example.com/b.jpg | Multiple images — comma-separated URLs. |
Comma in text fields: If a text value contains commas, wrap the cell in double quotes in the CSV file.