Uploading a local CSV file to Snowflake

I've been working with snowflake intermittently now for the past couple of years but had a recent interview question that stumped me - how do you load a local CSV to Snowflake? I managed to answer the question well enough, speaking about creating a schema, file format and target table to copy data into but my answer was lacking the most key element - how do you actually get the csv data into snowflake in the first place? Turns out theres a few options out there but the one that seemed simplest to me was via SnowSQL client. In this blog I'll explain from start to finish how you go about this process.

1. Prepare Your CSV File and save locally

  • Try to clean up the csv as much as possible – check for formatting issues and a clean header row.
  • The example table named ‘csv_file.csv’ I’m working with looks like this:

id,name,created_at

1,Alice,2024-12-01

2,Bob,2025-01-15

3,Charlie,2025-02-20

4,Diana,2025-03-05

5,Ethan,2025-04-10

 

2.  Define a file format

CREATE OR REPLACE FILE FORMAT my_csv_format

  TYPE = 'CSV';

 

3. Create a Target Table in Snowflake

CREATE OR REPLACE TABLE csv_table (

    id INT,

    name STRING,

    created_at DATE

);

 

4. Create a Snowflake Stage

CREATE OR REPLACE STAGE my_stage;

 

5. Upload the csv file

Ensure SnowSQL client is downloaded and installed. Run the below command in SnowSQL Client.

PUT file://path/to/csv_file.csv @my_stage

 

4. Load the CSV File into the Table

COPY INTO csv_table

FROM @my_stage/csv_file.csv

FILE_FORMAT = my_csv_format;

 

5. Verify the Data

SELECT *

FROM csv_table;

Author:
Asha Daniels
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab