---
title: "Integrating ClickHouse with Google Cloud Storage (GCS)"
description: "Import from, export to, and transform GCS data in flight with ClickHouse built-in functions"
category: "DATA_INGESTION"
support: "CORE"
docs: "https://clickhouse.com/docs/integrations/connectors/data-sources/gcs"
---

# Google Cloud Storage (GCS)

### Reading data from Google Cloud Storage
Using ClickHouse <a href="https://clickhouse.com/docs/en/integrations/s3/s3-table-functions" target="_blank">S3 table function</a>, users can query GCS data as a source without requiring persistence in ClickHouse. The following example illustrates how to read 10 rows of the 
<a href="https://clickhouse.com/docs/en/getting-started/example-datasets/nyc-taxi" target="_blank">NYC Taxi dataset</a>.
```sql
SELECT 
    trip_id, 
    total_amount, 
    pickup_longitude, 
    pickup_latitude, 
    dropoff_longitude, 
    dropoff_latitude, 
    pickup_datetime, 
    dropoff_datetime,
    trip_distance
FROM s3(
    'https://storage.googleapis.com/clickhouse-public-datasets/nyc-taxi/trips_{0..2}.gz',
    'TabSeparatedWithNames'
) LIMIT 10;
```

### Inserting Data from Google Cloud Storage
To transfer data from GCS to ClickHouse, users can combine the s3 table function with INSERT statement. Let's create an empty `trips` table:
```sql
CREATE TABLE trips ORDER BY tuple
(
) EMPTY AS SELECT * FROM s3(
    'https://storage.googleapis.com/clickhouse-public-datasets/nyc-taxi/trips_{0..2}.gz',
    'TabSeparatedWithNames'
);
```
This creates an empty table using the schema inferred from the data. We can then insert the first 1 million rows from the remote dataset
```sql
INSERT INTO trips SELECT *
FROM 
s3(
    'https://storage.googleapis.com/clickhouse-public-datasets/nyc-taxi/trips_{0..2}.gz',
    'TabSeparatedWithNames'
    )
LIMIT 1000000;
```