> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Linking Google Cloud Storage as a source Canonical URL: https://posthog.com/docs/data-pipelines/sources/gcs > **Cloud region:** This page uses US Cloud hosts. For an EU Cloud project, use `https://eu.posthog.com` instead of `https://app.posthog.com` (app host for links). ## On this page - [Step 1: Creating a bucket in GCS](#step-1-creating-a-bucket-in-gcs) - [Step 2: Set up a service account](#step-2-set-up-a-service-account) - [Step 3: Set up access keys.](#step-3-set-up-access-keys) - [Step 4: Create the table in PostHog](#step-4-create-the-table-in-posthog) - [Step 5: Query the table](#step-5-query-the-table) ![](https://res.cloudinary.com/dmukukwp6/image/upload/texture_tan_9608fcca70) ![](https://res.cloudinary.com/dmukukwp6/image/upload/texture_tan_dark_a92b0e022d) Let AI connect your sources for you Skip the manual setup — run this in your project and the wizard auto-detects your databases and APIs and connects them to PostHog. `npx @posthog/wizard warehouse` ![PostHog Wizard hedgehog](https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png) ![](https://res.cloudinary.com/dmukukwp6/image/upload/wizard_3f8bb7a240.png)Let AI connect your sources for you You can sync and query files and folders from Google Cloud Storage (GCS) in PostHog by setting up a link. ## Step 1: Creating a bucket in GCS 1. Go to your Google Cloud console. 2. Create a bucket in GCS. - For location, we recommend choosing `us-east1` for US Cloud or `europe-west3` for EU Cloud to keep them close to our servers. - For storage class, choose `Standard`. - For access control, choose `Uniform`. 3. Upload your data to the bucket. This can be as simple as a `.csv` file like this: ```csv name,age John,30 Jane,25 ``` ## Step 2: Set up a service account GCS uses service accounts to control access to resources. We need one to connect to GCS. To create one: 1. Go to the [service accounts page](https://console.cloud.google.com/iam-admin/serviceaccounts) in the GCS console and click **Create service account**. 2. Fill in the account name and ID and click **Create and continue**. 3. Grant the account the **Storage Object User** role. 4. Click **Done**. ## Step 3: Set up access keys. 1. Go to the [cloud storage settings page](https://console.cloud.google.com/storage/settings) and click the **Interoperability** tab. 2. Click **Create a key for another service account**. 3. Select the service account you created in step 2 and click **create key**. 4. Copy both the access key and secret. Save them some place safe because you'll need to regenerate them if you lose them. ## Step 4: Create the table in PostHog 1. Go to the [Data pipeline page](https://app.posthog.com/data-management/sources) and the sources tab in PostHog 2. Click **New source**. Under self managed, look for **Google Cloud Storage** and click **Link** 3. Fill the table name, then use the data from GCS: - For files URL pattern, use `https://storage.googleapis.com/` followed by your bucket and file or folder name like `https://storage.googleapis.com/posthog-warehouse/july12_google_ads_fixed.csv`. You can also use `*` to query multiple files. - Choose the correct file format - When using CSV format, choose the **CSV quote handling** option: **RFC 4180 double quotes** for CSVs that use standard double-quote escaping, or **Literal quotes** (default) for CSVs where quotes are treated as literal characters. - For access key, use your Access Key ID - For secret key, use your Secret Access Key 4. Click **Next** ![GCS source configuration form](https://res.cloudinary.com/dmukukwp6/image/upload/Clean_Shot_2024_07_17_at_13_03_25_2x_0ec0ddecaf.png) ## Step 5: Query the table Once it is done syncing, you can now [query](https://posthog.com/docs/data-warehouse/query.md) your new table using the table name.