Files
ewoooc/docs/guides/google_drive_setup.md
2026-06-15 15:14:37 +08:00

1.3 KiB
Raw Permalink Blame History

Google Drive API 設定指南

📋 功能說明

系統自動化流程PChome 後台業績匯出):

  1. PChome 後台業績 Excel 先被放入 Google Drive 當日業績匯入 資料夾。
  2. momo-scheduler 每 30 分鐘檢查待匯入檔案。
  3. 自動下載 即時業績_當日.xlsx 或符合設定 pattern 的 Excel。
  4. 自動辨識明細 worksheet / 表頭列,匯入至 daily_sales_snapshot 並同步 realtime_sales_monthly
  5. 成功檔案歸檔至 已匯入;格式或日期不合格的檔案移至 匯入失敗,避免重複告警。

🔑 認證資訊庫

項目
Google Cloud 專案名 wooo-481204
Client ID 132823079326-h9cvj5eahigm8hp9q0b7t5rk77bhu3gp...
認證帳號 owen.tsai@gmail.com

🛠️ 首次認證步驟

config/google_token.pickle 遺失或過期,執行以下指令:

python3 -c "from services.google_drive_service import drive_service; drive_service.authenticate()"

執行後會彈出瀏覽器要求授權。


📁 資料夾結構要求

Google Drive 根目錄必須存在: 我的雲端硬碟/業績報表/當日業績/

後續若要把 PChome 後台人工匯出改成全自動,先閱讀 docs/guides/pchome_sales_import_automation.md