Google Cloud Storage 到 Google Sheets 传输操作符

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

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

先决任务

要使用这些操作符,您需要执行以下几项操作:

将数据从 GCS 上传到 Google Sheets

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

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

upload_gcs_to_sheet = GCSToGoogleSheetsOperator(
    task_id="upload_gcs_to_sheet",
    bucket_name=BUCKET_NAME,
    object_name="{{ task_instance.xcom_pull('upload_sheet_to_gcs')[0] }}",
    spreadsheet_id="{{ task_instance.xcom_pull(task_ids='create_spreadsheet', key='spreadsheet_id') }}",
    gcp_conn_id=CONNECTION_ID,
)

您可以将 Jinja templatingspreadsheet_id, bucket_name, object_name, spreadsheet_range, impersonation_chain 结合使用。

此条目有帮助吗?