1. Meet BigQuery: store big tables, ask with SQL
1.3 Loading data: from files to tables
Highlights & notes
Select lesson text to highlight it, or tap Add note.
Bookmarks
Bookmark a lesson to see it here.
Data is born outside BigQuery. An app writes CSV files. A partner sends JSON. A data engineer's first job is ingestion: getting those files into a table.
The usual path on Google Cloud:
- Files land in a Cloud Storage bucket, which is an online folder, for example
gs://shop-raw/orders/2026-01-05.csv - A load job copies them into a BigQuery table
- Batch load jobs are free. You pay only to store the data afterwards.
BigQuery can load CSV, JSON (one object per line), Avro, Parquet and ORC. Parquet and Avro files carry their own column names and types, so they are safer than CSV. For CSV you give the schema, or ask BigQuery to guess it. Guessing is called autodetect.
Two ways to use a file
- Load it: the data is copied into BigQuery. Fast to query. This is the normal choice.
- External table: the data stays in the bucket and BigQuery reads the file each time. Handy for a quick look, slower for daily use.
Load raw files as they are into a raw table first. Do not clean while loading. If a cleaning rule turns out wrong, you can fix it later because the raw copy is safe.
How it fits together
- App writes CSV
- Cloud Storage bucket
- Load job
- BigQuery table
Load a CSV file with SQL
One statement copies the file from the bucket into a table.
SQL
LOAD DATA INTO bronze.orders_rawFROM FILES ( format = 'CSV', skip_leading_rows = 1, uris = ['gs://shop-raw/orders/2026-01-05.csv']);
Rows at this step
order_id | product | amount ---------+---------+------- 101 | Laptop | 55000 102 | Mouse | 700
Try it yourself
1. Make a small file orders.csv on your laptop with a header line and three orders.
2. In BigQuery, open your sales dataset, click Create table, choose Upload and pick the file. Tick Auto detect for the schema.
3. Open the new table's Schema tab. Did BigQuery guess the types you expected?
Question 1 · Easy
Where do raw files usually wait before they are loaded into BigQuery?
Question 2 · Medium
Which file format carries its own column names and types?
Question 3 · Hard
You run the same LOAD DATA INTO statement twice by mistake. What happens?
Key takeaways
Ingestion means getting files into tables. Files wait in a Cloud Storage bucket and a free load job copies them into BigQuery. Keep a raw copy first and clean it in a later step.
Save your progress
Start free and your progress, code and notes stay saved. Free for 1 month, no card needed.
Start free Log in