Google Sheets 到 Google Cloud Storage 传输 Operators

Google 提供了一项服务 Google Cloud Storage。该服务用于存储来自各种应用程序的大数据。

借助 Google Sheets,每个人都可以同时在同一个电子表格中协作。使用公式、函数和格式设置选项,可以节省时间并简化常见的电子表格任务。

先决条件任务

要使用这些 Operators,您必须完成以下几项操作

将数据从 Google Sheets 上传到 GCS

要将数据从 Google Spreadsheet 上传到 Google Cloud Storage,可以使用 GoogleSheetsToGCSOperator

tests/system/google/cloud/gcs/example_sheets_to_gcs.py

upload_sheet_to_gcs = GoogleSheetsToGCSOperator(
    task_id="upload_sheet_to_gcs",
    destination_bucket=BUCKET_NAME,
    spreadsheet_id="{{ task_instance.xcom_pull(task_ids='create_spreadsheet', key='spreadsheet_id') }}",
    gcp_conn_id=CONNECTION_ID,
)

您可以将 Jinja 模板spreadsheet_id, destination_bucket, destination_path, sheet_filter, impersonation_chain 一起使用。

此条目有帮助吗?