Skip to main content

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

SourceWhen to use
Upload fileOne-off or repeated manual uploads from your computer.
Remote URL / Google SheetsPaste 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

  1. Open Database → CSV import (or your map’s CSV source tab).
  2. Choose Upload file or Remote URL / Google Sheets and provide the file or URL.
  3. Click Sync fields — review detected columns and add any suggested fields.
  4. Set options (ID column, geocoding, auto-refetch for remote sources, etc.).
  5. Use Continue / Save settings / Import now as shown in the UI.
  6. Use See logs if you need import history or troubleshooting.

Example spreadsheets

CSV field format reference

The following matches the CSV import instructions & field reference modal in the plugin.

Field typeExample valueNotes
TextCoffee RoastersStored as-is.
Number4.5Integer or decimal. Stored as-is.
Select, Radio, Status1Option value — stored directly.
NorthOption label — resolved to the matching value automatically.
South-WestInvalid — must match an existing option value or label exactly.
Select (multiselect)Coffee,TeaComma-separated list. Each token matched by value or label.
BeerSingle value.
CheckboxesWifi,ParkingComma-separated list. Each token matched by value or label.
WifiSingle value.
Checkbox1 / 0Checked / unchecked.
true / falseChecked / unchecked (text form).
Location40.7128,-74.0060lat,lng — valid range: ±90 lat, ±180 lng.
ParisAddress — geocoded when Google Geocoding is enabled (~1,300 free requests/day tier; runs in the background).
Main st. 1, New York, USAAddress with commas — accepted.
99.1211,199.2323Invalid — coordinates outside valid range.
RegionsUS-TXSingle region ID.
US-TX,US-AL,US-NYMultiple region IDs — comma-separated.
US-TX US-AL US-NYInvalid — use commas between IDs, not spaces.
Post42WordPress post ID — verified to exist before storing.
my-post-slugPost slug — resolved to the post ID.
Date / Datetime2024-06-15Date only (YYYY-MM-DD).
2024-06-15 14:30:00Date and time (YYYY-MM-DD HH:MM:SS).
Imagehttps://example.com/photo.jpgSingle remote URL — downloaded to the Media Library; same URL is not downloaded twice.
https://example.com/a.jpg,https://example.com/b.jpgMultiple images — comma-separated URLs.

Comma in text fields: If a text value contains commas, wrap the cell in double quotes in the CSV file.