Import data from CSV, TSV, JSON or Excel
Open in CalíopeLoads one or more CSV, TSV, JSON or Excel files into an existing table or a new one, with a three-step wizard that checks on the server how many rows went in.
Where it is: Schema tree › context menu › Import data…
The Data Import wizard loads a file into a table without writing SQL: into one that already exists, or into a new table it creates.
How to open it (with a session that can write: in a read-only one it isn't offered):
- In the schema tree, the context menu of a database: Import a file into a new table…
- The context menu of a table: Import data…; that table becomes the destination.
- The import button in the header of the schema panel, next to the DDL history: it opens a new table in the selected database.
- On the Mac, also File › Import data…, even when the SQL Editor isn't in front.
- On iPad, iPhone and Apple Vision Pro, the context menu opens with a long press; on Vision Pro, look at the name and pinch and hold.
Step 1 — The file
- Press Select files… and pick one or more.
- CSV (
.csv) — comma-separated, with RFC 4180 quoting: a quoted field can hold commas and line breaks. - TSV (
.tsv,.tab) — tab-separated. - JSON — an array of objects (
[{"col": value}, …]); the keys are the column names. - Excel (.xlsx) — the first sheet is read; the others don't go in.
- A CSV or TSV has no size limit: it's read in chunks, and when you pick it only the first 10,000 rows are read, for the preview and the types. A JSON or Excel file is read whole, and one over 64 MB is turned down before it's opened, with the file's size and the maximum.
- Text has to be UTF-8, with or without a BOM. A file in another encoding is turned down with a message saying so: save it as UTF-8 and pick it again.
- Several at once go into the same table, one after another. With a header they're matched by column name, in any order; without one, by position. A file that doesn't match the first is named along with what it's missing or has extra, and Next → stays off until you remove it.
- If the first row of a CSV, a TSV or a sheet isn't names, turn off First row is header: the columns are numbered and that row goes in with the rest.
Step 2 — Columns: the destination —an existing table or a New table, with a name you can change— and, for each column of the file, where it goes and what type it is (see Columns and types when importing). A new table whose name already exists isn't overwritten: the wizard says so and leaves you on this step.
Step 3 — Import
- If the server supports more than one way of handling duplicates, choose the mode (see Import modes).
- Choose the batch size: 100, 500 —the default— or 1000 rows per statement.
- Press Import. If the connection has a label that asks to confirm writes, the question comes once, with the
CREATE TABLEand the firstINSERTin view. - A bar shows the progress. Closing the wizard does not stop the import: it carries on in Activity, in the toolbar, and opening the wizard again shows how far it has got. Stop stops it between one batch and the next; closing the session stops it too.
- When it ends, if you closed the wizard or Calíope is not in front of you, the system notifies you with its sound; turn it on or off in Settings › General › Notifications › Migration, import or export finished. If there were errors it says so and, if any batch failed, how many out of how many. A stopped import does not notify.
The result is counted by the server, before and after, not by the app:
- The rows in the file, the ones that went in, the ones set aside and the ones the server didn't accept. A cell that doesn't fit its column's type sets the whole row aside instead of sending it as text; the first ten are shown, with their row, their column and the reason.
- A verdict: ✓ Matches, ✗ Does not match with the difference, or – Not compared with the reason (the server didn't allow counting, or the table merges rows when it stores them).
- With several files, one line per file and, if it stopped, in which one.
Available on macOS, iPad, iPhone and Apple Vision Pro.
Keywords: import, csv, tsv, json, excel, xlsx, data, load, wizard, file, several files, new table, create table, rows, table, insert, count, utf-8