Google Apps Script 可以做那些事情
Google Apps Script 是一個快速應用程式的開發平台,可讓您快速輕鬆的建立與 Google Workspace 整合的業務應用程式。
支援使用 JavaScript 撰寫程式碼,並存取 Gmail、日曆、雲端硬碟等 Google Workspace 應用程式的函式庫。無需安裝任何程式編輯程式,透過網頁編輯器就可以撰寫Google Apps 腳本,腳本立即可以在 Google 的服務器(Serverless)上執行。
Google Apps Script 可以賦予 Google文件那些功能?
- 為Google 的文件、試算表和表單添加額外的小工具。
- 可以為Google 試算表建立自動化腳本。
- 支援發布一個網頁應用程式,並嵌入Google協作平台中的應用程式。
- 支援與其他Google 服務互動,包括 AdSense, Analytics, Calendar, Drive, Gmail, and Maps。
- 支援Add-ons,用來擴展 Google 文件、試算表、簡報和表單之功能,也可將它們發佈到Add-ons商店。
- 支援將 Android 應用程序轉換至Android add-ons,以便可以在移動裝置與用戶的 Google 文件交換數據。
- 支援聊天機器人(Chat Bot)應用 。
Google Apps Script的優勢
- 雲端腳本語言 : 語法類似 Javascript,大幅降低學習成本。
- 可擴展Google Apps的能力 : 可以建構類似巨集的效果,達到工作流程自動化的目標。
- 可以建立Web應用程式 : 應用程式有2種運作模式,一為整合Google協作工具,二為可以獨立運作。
- 開發者完全不需要準備伺服器,支援HTML、CSS、JavaScript…等語言,來建置網頁的畫面 。
Google Apps Script 如何使用
1. 安裝Google Apps Script

2. 安裝Google Apps Script 應用程式

↓

↓

3. 安裝完成可於應用清單中找到

Google Apps Script 開發環境介紹
1. 建立一個新專案

2. 指令碼編輯工具

3. 專案使用狀態追蹤

Google Apps Script 應用範例
1. 使用Apps script 自動建立工作表
(1) 新增一個 google 試算表

(2) 開啟並建立編輯器

(3) 撰寫Google Apps Script 程式碼並執行程式

(4) Google 要求授權存取試算表

↓

(5) 查看Google 試算表自動新增2個工作表

2. 使用Google翻譯 + line機器人打造自己專屬的翻譯機
(1) 使用Google 試算表配置要翻譯的語系

(2) 配置Line機器人

(3) 撰寫Apps Script 程式碼

(4) 發佈成為一個網頁應用程式

↓

(5) 複製網頁應用程式,後續提供給Line webhook使用

(6) 配置Webhook,把Apps Script與LineBot 整合

(7) 驗證LineBot翻譯程式

Google Apps Script 限制
Apps Script 服務對某些功能有每日配額和限制。如果超出配額或限制,您的腳本將出現異常並停止。
存取配額
特徵 | Gmail帳戶 | 商用帳戶 |
---|---|---|
創建日曆事件 | 5,000 / 天 | 10,000 / 天 |
創建聯繫人 | 1,000 / 天 | 2,000 / 天 |
創建文件 | 250/天 | 1,500 / 天 |
轉換的文件 | 2,000 / 天 | 4,000 / 天 |
每天的電子郵件收件人 | 100 / 天 | 1,500 / 天 |
網域內的電子郵件收件人 | 100 / 天 | 2,000 / 天 |
電子郵件讀/寫(不包括發送) | 20,000 / 天 | 50,000 / 天 |
群組閱讀次數 | 2,000 / 天 | 10,000 / 天 |
JDBC連接 | 10,000 / 天 | 50,000 / 天 |
JDBC 連接失敗 | 100/天 | 500/天 |
創建簡報 | 250/天 | 1,500 / 天 |
屬性讀取上限(讀/寫) | 50,000 / 天 | 500,000 / 天 |
創建簡報 | 250/天 | 1,500 / 天 |
創建試算表 | 250/天 | 3,200 / 天 |
觸發總運行時間 | 90 分鐘/天 | 6 小時/天 |
URL呼叫次數 | 20,000 / 天 | 100,000 / 天 |
執行限制
特徵 | Gmail帳戶 | 商用帳戶 |
---|---|---|
腳本運行時間 | 6 分鐘/執行 | 6 分鐘/執行 |
自定義函數運行時間 | 30 秒/執行 | 30 秒/執行 |
同時執行 | 30 | 30 |
電子郵件附件 | 250 / msg | 250 / msg |
電子郵件正文大小 | 200 KB / msg | 400 KB / msg |
每封郵件的收件人數量 | 50 / msg | 50 / msg |
電子郵件總附件大小 | 25 MB / msg | 25 MB / msg |
屬性值大小 | 9 KB / val | 9 KB / val |
觸發器 | 20 / 用戶 / 腳本 | 20 / 用戶 / 腳本 |
URL 獲取響應大小 | 50 MB / call | 50 MB / cell |
網址提取標頭 | 100 / call | 100 / call |
URL Fetch 標頭大小 | 8 KB / call | 8 KB / call |
URL 獲取 POST 大小 | 50 MB / call | 50 MB / call |
網址提取網址長度 | 2 KB / call | 2 KB / call |
參考文件:
- Google Developer – Overview of Google Apps Script
- Quotas for Google Services | Apps Script
- Google Apps Script
- Samples | Apps Script
發佈日期: 2021-08-26 | Iron | 點看更多雲端好文