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 works without any special server-side file access. For larger or messier CSVs, pgloader handles encoding, type coercion, and parallel loading. See Import data from CSV for the full walkthrough.

Import a CSV with psql

First, create the destination table. The columns and order must match the CSV:

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 (copy the psql command from the Connection Details modal, opened from Connect on your Project Dashboard) and load the file:

\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 or differently-ordered columns than the table:

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

When to reach for pgloader

pgloader is a third-party tool worth using 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, not just CSV

It writes a small config file that describes the source, target, and any transformations, then runs the load with error reporting. 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. Either approach (psql \copy or COPY FROM STDIN from a driver) streams 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.