Create the target table in Neon, then run \copy from a psql session connected to your database. \copy streams the CSV from your local filesystem over the existing connection, so it doesn't need access to the server's filesystem. For larger or messier CSVs, pgloader handles encoding, type coercion, and parallel loading. See Import data from CSV.

Import a CSV with psql

First, create the destination table. Unless you list columns in the \copy command, the table columns must match the CSV columns in number and order:

CREATE TABLE customer (
  id          SERIAL PRIMARY KEY,
  first_name  VARCHAR(50),
  last_name   VARCHAR(50),
  email       VARCHAR(255)
);

You can run this from the Neon SQL Editor or from psql.

Then connect with psql and load the file. To get the connection command, click Connect in the Neon Console and pick psql from the drop-down menu.

\copy customer FROM '/path/to/customer.csv' DELIMITER ',' CSV HEADER;

On success, psql prints the number of rows loaded:

COPY 1842

CSV HEADER tells psql to skip the first row of the file. Drop HEADER if your CSV has no header line.

Load specific columns

If the CSV has fewer columns than the table, or a different column order, list the columns in CSV order:

\copy customer (first_name, last_name, email) FROM '/path/to/customer.csv' DELIMITER ',' CSV HEADER;

When to use pgloader

pgloader is a third-party tool. Use it when:

  • The CSV is millions of rows and you want parallel loading
  • Source columns need type casts or date parsing
  • The file has encoding issues, embedded quotes, or inconsistent rows
  • You're loading from MySQL, SQLite, or another database rather than a CSV file

You write a small config file that describes the source, target, and any transformations, and pgloader runs the load and reports rows that fail. See the pgloader documentation for syntax.

The SQL Editor does not support \copy

\copy is a psql client-side meta-command. It runs in psql itself, not on the Postgres server. The Neon SQL Editor in the Console supports many meta-commands (\dt, \d, \l), but not \copy. Use psql, a Postgres GUI like DBeaver or pgAdmin, or a script in your language of choice.

COPY FROM STDIN works too

The server-side COPY ... FROM '/path/to/file.csv' form reads from the Postgres server's filesystem, which isn't accessible on Neon. COPY ... FROM STDIN works fine over a connection and is what \copy uses under the hood. Both psql \copy and COPY FROM STDIN from a driver stream the data from the client.

Walk through a full CSV import

Step-by-step example: connect, create the table, prep the CSV, and load with psql.