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 結合使用。

此條目有幫助嗎?