Google Cloud Storage 至 Google Sheets 傳輸運算子

Google 提供一項服務 Google Cloud Storage。此服務用於儲存來自各種應用程式的大型資料。

透過 Google Sheets,所有人都可以同時在同一個試算表中協作。使用公式、函數和格式設定選項,以節省時間並簡化常見的試算表任務。

先決條件任務

若要使用這些運算子,您必須完成幾件事

從 GCS 上傳資料至 Google Sheets

若要從 Google Cloud Storage 上傳資料至 Google 試算表,您可以使用 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 範本spreadsheet_idbucket_nameobject_namespreadsheet_rangeimpersonation_chain 搭配使用。

這個條目是否有幫助?