Ingest data from Google Drive

Important

This feature is in Beta. Workspace admins can control access to this feature from the Previews page. See Manage Azure Databricks previews.

This page shows how to create a managed Google Drive ingestion pipeline using Lakeflow Connect.

Before you begin

  • To create the ingestion pipeline, you must first meet the following requirements:

    • Your workspace must be enabled for Unity Catalog.

    • Serverless compute must be enabled for your workspace. See Serverless compute requirements.

    • If you plan to create a new connection: You must have CREATE CONNECTION privileges on the metastore. See Manage privileges in Unity Catalog.

      If the connector supports UI-based pipeline authoring, an admin can create the connection and the pipeline at the same time by completing the steps on this page. However, if the users who create pipelines use API-based pipeline authoring or are non-admin users, an admin must first create the connection in Catalog Explorer. See Connect to managed ingestion sources.

    • If you plan to use an existing connection: You must have USE CONNECTION privileges or ALL PRIVILEGES on the connection object.

    • You must have USE CATALOG privileges on the target catalog.

    • You must have USE SCHEMA and CREATE TABLE privileges on an existing schema or CREATE SCHEMA privileges on the target catalog.

  • To ingest from Google Drive, you must first configure OAuth 2.0 and create a Unity Catalog connection. See Set up Google Drive for managed ingestion.

Create an ingestion pipeline

For a list of supported file formats and connector-specific limitations, see Google Drive connector limitations.

Declarative Automation Bundles

Use Declarative Automation Bundles to manage Google Drive pipelines as code. Bundles can contain YAML definitions of jobs and tasks, are managed using the Databricks CLI, and can be shared and run in different target workspaces (such as development, staging, and production). For more information, see What are Declarative Automation Bundles?.

  1. Create a bundle using the Databricks CLI:

    databricks bundle init
    
  2. Add two new resource files to the bundle:

    • A pipeline definition file (for example, resources/gdrive_pipeline.yml). See pipeline.ingestion_definition and Examples.
    • A job definition file that controls the frequency of data ingestion (for example, resources/gdrive_job.yml).
  3. Deploy the pipeline using the Databricks CLI:

    databricks bundle deploy
    

Databricks notebook

  1. Import the following notebook into your Azure Databricks workspace:

    Get notebook

  2. Do not modify cell one.

  3. Modify cell three with your pipeline configuration details. See pipeline.ingestion_definition and Examples.

  4. Click Run all.

Examples

Use these examples to configure your pipeline.

Ingest files as binary (unstructured)

Ingest all files in a Google Drive folder as binary content. Use this approach for PDFs, Office documents, and other files you intend to process downstream, for example for RAG applications.

Declarative Automation Bundles

resources:
  pipelines:
    gdrive_binary_pipeline:
      name: gdrive_binary_pipeline
      catalog: main
      schema: ingest_destination_schema
      channel: PREVIEW
      ingestion_definition:
        connection_name: <gdrive-connection>
        objects:
          - table:
              destination_catalog: main
              destination_schema: ingest_destination_schema
              destination_table: drive_folder
              connector_options:
                gdrive_options:
                  entity_type: FILE
                  url: https://drive.google.com/drive/folders/<folder_id>
                  file_ingestion_options:
                    format: BINARYFILE
                    schema_evolution_mode: NONE

Databricks notebook

pipeline_spec = """
{
  "name": "<pipeline-name>",
  "catalog": "main",
  "schema": "ingest_destination_schema",
  "ingestion_definition": {
    "connection_name": "<gdrive-connection>",
    "objects": [
      {
        "table": {
          "destination_catalog": "main",
          "destination_schema": "ingest_destination_schema",
          "destination_table": "drive_folder",
          "connector_options": {
            "gdrive_options": {
              "entity_type": "FILE",
              "url": "https://drive.google.com/drive/folders/<folder_id>",
              "file_ingestion_options": {
                "format": "BINARYFILE",
                "schema_evolution_mode": "NONE"
              }
            }
          }
        }
      }
    ]
  },
  "channel": "PREVIEW"
}
"""
create_pipeline(pipeline_spec)

Ingest structured files with a path filter

Ingest CSV files from a Google Drive folder. Use file_filters to restrict ingestion to files matching a glob pattern.

Declarative Automation Bundles

resources:
  pipelines:
    gdrive_csv_pipeline:
      name: gdrive_csv_pipeline
      catalog: main
      schema: ingest_destination_schema
      channel: PREVIEW
      ingestion_definition:
        connection_name: <gdrive-connection>
        objects:
          - table:
              destination_catalog: main
              destination_schema: ingest_destination_schema
              destination_table: csv_files
              connector_options:
                gdrive_options:
                  entity_type: FILE
                  url: https://drive.google.com/drive/folders/<folder_id>
                  file_ingestion_options:
                    format: CSV
                    schema_evolution_mode: NONE
                    file_filters:
                      - path_filter: '*.csv'

Databricks notebook

pipeline_spec = """
{
  "name": "<pipeline-name>",
  "catalog": "main",
  "schema": "ingest_destination_schema",
  "ingestion_definition": {
    "connection_name": "<gdrive-connection>",
    "objects": [
      {
        "table": {
          "destination_catalog": "main",
          "destination_schema": "ingest_destination_schema",
          "destination_table": "csv_files",
          "connector_options": {
            "gdrive_options": {
              "entity_type": "FILE",
              "url": "https://drive.google.com/drive/folders/<folder_id>",
              "file_ingestion_options": {
                "format": "CSV",
                "schema_evolution_mode": "NONE",
                "file_filters": [
                  { "path_filter": "*.csv" }
                ]
              }
            }
          }
        }
      }
    ]
  },
  "channel": "PREVIEW"
}
"""
create_pipeline(pipeline_spec)

Ingest file metadata only

Ingest file metadata (name, size, timestamps, path) without downloading file contents. Use this approach when you require an inventory of files without the overhead of ingesting their content.

Declarative Automation Bundles

resources:
  pipelines:
    gdrive_metadata_pipeline:
      name: gdrive_metadata_pipeline
      catalog: main
      schema: ingest_destination_schema
      channel: PREVIEW
      ingestion_definition:
        connection_name: <gdrive-connection>
        objects:
          - table:
              destination_catalog: main
              destination_schema: ingest_destination_schema
              destination_table: file_metadata
              connector_options:
                gdrive_options:
                  entity_type: FILE_METADATA
                  url: https://drive.google.com/drive/folders/<folder_id>
                  file_ingestion_options:
                    format: BINARYFILE
                    schema_evolution_mode: NONE

Databricks notebook

pipeline_spec = """
{
  "name": "<pipeline-name>",
  "catalog": "main",
  "schema": "ingest_destination_schema",
  "ingestion_definition": {
    "connection_name": "<gdrive-connection>",
    "objects": [
      {
        "table": {
          "destination_catalog": "main",
          "destination_schema": "ingest_destination_schema",
          "destination_table": "file_metadata",
          "connector_options": {
            "gdrive_options": {
              "entity_type": "FILE_METADATA",
              "url": "https://drive.google.com/drive/folders/<folder_id>",
              "file_ingestion_options": {
                "format": "BINARYFILE",
                "schema_evolution_mode": "NONE"
              }
            }
          }
        }
      }
    ]
  },
  "channel": "PREVIEW"
}
"""
create_pipeline(pipeline_spec)

Declarative Automation Bundles job definition file

The following is an example job definition file for use with Declarative Automation Bundles. The job runs every day, exactly one day from the last run.

Declarative Automation Bundles

resources:
  jobs:
    gdrive_job:
      name: gdrive_job

      trigger:
        periodic:
          interval: 1
          unit: DAYS

      email_notifications:
        on_failure:
          - <email-address>

      tasks:
        - task_key: refresh_pipeline
          pipeline_task:
            pipeline_id: ${resources.pipelines.gdrive_binary_pipeline.id}

Configure file ingestion options

The file_ingestion_options block controls how files are processed. All options are set inside the gdrive_options.file_ingestion_options block in the pipeline definition.

File filters

Use file_filters to restrict which files are ingested from the source URL:

"file_ingestion_options": {
  "format": "CSV",
  "file_filters": [
    { "path_filter": "invoices/*.csv" },
    { "modified_after": "2026-01-01T00:00:00" }
  ]
}

For full file_ingestion_options parameter reference, see Google Drive connector reference.

Schema evolution

Set schema_evolution_mode to control how new columns in incoming files are handled. Modes match Auto Loader schema evolution modes. For details, see Google Drive connector reference.

Schema hints

Override inferred column types using schema_hints:

"file_ingestion_options": {
  "format": "CSV",
  "schema_hints": "order_id INT, amount DOUBLE, ts TIMESTAMP"
}

See Override schema inference with schema hints for usage details.

Format-specific options

Pass format-specific options using format_options:

"file_ingestion_options": {
  "format": "CSV",
  "format_options": {
    "header": "true",
    "sep": ","
  }
}

Supported keys are the standard Auto Loader format options. See Format options.

Common patterns

For advanced pipeline configurations, see Common patterns for managed ingestion pipelines.

Next steps

Start, schedule, and set alerts on your pipeline. See Common pipeline maintenance tasks.

Additional resources