SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
⼯工 作 雜 事 ⾃自 動 化 , 實 踐 辦 公 室
構 ! 造 ! 改 ! ⾰革 !
By Adrian Wu
⽤用 Google Apps Script
挑戰輕鬆 RPA
1. RPA 概念念與⾃自動化的難題
2. Google Apps Script 的優勢
3. 開發案例例分享
• 業務流程⾃自動化(⾃自動產⽣生給客⼾戶的成效報表)
• 報名系統⾃自動化(⾃自動回信,資料整合)
• 股票盯盤(⾃自動抓10多個網站的資訊,⾃自動通知)
4. 活⽤用 GAS 提升穩定性
⼤大綱
⽤用 G o o g l e A p p s S c r i p t 挑 戰 輕 鬆 R P A
推廣利利⽤用 Google Apps Script
來來實踐辦公室 RPA,讓繁瑣
⼯工作⾃自動化,提升⼯工作效率!
RPA 概念念與⾃自動化的難題
如 果 可 以 , 我 也 想 要 躺 著 ⼯工 作 R r r
懶懶惰的⼯工程師,才是好⼯工程師!
- 魯魯迅
你是否有聽過類似的都市傳說呢?
R P A 概 念念 與 ⾃自 動 化 的 難 題
什什麼是 RPA (Robotic Process Automation) ?
R P A 概 念念 與 ⾃自 動 化 的 難 題
流程機器⼈人(Robotic Process Automation, RPA) 

是⼀一種⽤用來來將辦公室電腦作業,反覆執⾏行行的瑣碎流程,轉為⾃自動化的軟體。
它類似於電腦桌⾯面上有⼀一個虛擬⾃自動的⼿手,專⾨門⽤用來來處理理⼀一些有規則性、很
機械化、但⼜又⾼高準確率要求的重複性動作
什什麼是 RPA (Robotic Process Automation) ?
R P A 概 念念 與 ⾃自 動 化 的 難 題
什什麼是 RPA (Robotic Process Automation) ?
R P A 概 念念 與 ⾃自 動 化 的 難 題
那麼......這麼好的東⻄西要怎麼開始呢?
Where to start?
標準 RPA Side Project 專案流程圖
R P A 概 念念 與 ⾃自 動 化 的 難 題
我有⼀個
⼤膽的想法
忙,是治療⼀切
精神病的良藥
⼈⽣已經
如此艱難
吹呀吹呀
我的驕傲放縱
Deploy Server
EnvironmentDatabase
rollback
Server Cost
DB server
Apps Script
Many Google apps, one platform in the cloud
Google Apps Script (GAS)
Many Google apps, one platform in the cloud
G o o g l e A p p s S c r i p t 介 紹
透過 Spreadsheet 直接充當資料庫,
在服務前期,資料格式不確定時,可避
免調整資料庫的⿇麻煩,達到快速開發
可以透過 Spreadsheet 儲存
⼤大多數功能可以在 Google Apps Script
免費額度中完成,⽽而且如果是 GSuite
的話,還能獲得進⼀一步擴充!
⼤大抵上免費
GAS 是⼀一個 serverless 服務,開發者
無須處理理伺服器,也沒有環境問題,
所有服務直接運⾏行行在 Google 雲端上
無需處理理 Server side
GAS 可以呼叫許多常⽤用的 Google 服務,
很多功能都無需另外建置,⽽而且無痛整合
GSuite 功能,非常適合⽣生產⼒力力⼯工具開發
連動 Google 服務
GAS 非常適合⽤用來來開發簡單服務 or GSuite related service
Latest Update:June 12, 2020
G o o g l e A p p s S c r i p t 介 紹
要能夠躺著⼯工作,我會需要什什麼功能?
午餐機器⼈人為例例:
Input Output
Magic
Million Dollar Idea!!!
G o o g l e A p p s S c r i p t 介 紹
要能夠躺著⼯工作,我會需要什什麼功能?
午餐機器⼈人為例例:
Input Output
Magic
Interface Interface
Database
G o o g l e A p p s S c r i p t 介 紹
要能夠躺著⼯工作,我會需要什什麼功能?
午餐機器⼈人為例例:
Input Output
Magic
Interface Interface
Database
Server
G o o g l e A p p s S c r i p t 介 紹
要能夠躺著⼯工作,我會需要什什麼功能?
午餐機器⼈人為例例:
Input Output
Magic
Interface Interface
Database
Production
Server
Development
Server
Deploy
G o o g l e A p p s S c r i p t 介 紹
要能夠躺著⼯工作,我會需要什什麼功能?
午餐機器⼈人為例例:
Input Output
Magic
Spreadsheet
Interface Interface
Focus Here!!
G o o g l e A p p s S c r i p t 介 紹
要能夠躺著⼯工作,我會需要什什麼功能?
Input Output
Magic
HtmlService /
Google Form /
API
HtmlOutput / TextOutput
+ Google Site
Spreadsheet
+ Glide App => pwa
Spreadsheet
Cloud SQL
BigQuery
doGet function
doPost function
Trigger
by event, by time
努⼒力力對抗無聊的 Routine Work
G o o g l e A p p s S c r i p t 開 發 案 例例
G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 簡 化 ⼯工 作 流 程
⾃自動化數據報表
每天都要⽣生⼀一堆數據報表給各家客⼾戶,
不但要⼿手動去網站抓資料,還要再⼈人⼯工 Key 成⽂文件,再寄出
⾃自動從服務中抓取今天的數據,⾃自動整理理並寫入⽂文件,
做成最後報告(還可以⾃自動寄給客⼾戶!)
廣告服務的⾃自動化報表(⼤大約 5-6 hrs)
廣告聯聯播網(Ad Network)
Web 廣告投放平台(SSP)
App 廣告投放平台(SSP)
有報表
無報表
GmailApp.search
BigQuery.Jobs.query
按客⼾戶訂單分配 +
處理理資料
DriveApp.makeCopy(template)
SpreadsheetApp
HtmlService
GmailApp.send
DriveApp
寄給客⼾戶
塞進精美表單
資料留留檔
or UrlFetchApp
Triggered at
10 ~ 11 am daily
G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 簡 化 ⼯工 作 流 程
G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 簡 單 的 ⼩小 S i d e P r o j e c t
⾃自動股票盯盤
每天都要花時間盯股票走勢,希望⼀一次可以追蹤⼤大量量股票,
⽽而且同時紀錄不同網站上⾯面蒐集到的各種數據分析
每天⾃自動爬 300 多隻股票,5000 多個網⾴頁的資料,
把相關的信號分析都跑⼀一遍,⽽而且⾃自動寄信通知美⽇日⾏行行情,
然後做成⼀一個簡單網站提供觀察
股票資料搜集爬蟲(第⼀一版,1 weekend)
美股數據網站
每天抓取超過
5000 多個網⾴頁
的股票數據
SpreadsheetApp
HtmlService
GmailApp.send
DriveApp
寄送每⽇日股票數據
塞進表單 資料留留檔
UrlFetchApp
Triggered at 5 am daily
台股數據網站
總經數據網站
股票新聞網站
每⽇日資料比對
每⽇日估值模型計算
產出簡單網⾴頁
HtmlService
透過 Google Site
組成簡單網站
同⼀一個 Trigger 內,連續 UrlFetch 時
GAS 會有 6-7 個 IP 輪輪流替換
Bootstrap, jQuery, Vue.js, D3.js 等
可以透過 CDN ⽅方式匯入
可以直接嵌⼀一個
iframe 上去
G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 簡 單 的 ⼩小 S i d e P r o j e c t
Google Finance API
⽤用 Google Apps Script 當作網⾴頁後端
function doGet(e){
switch(e.parameter.mode){
case ‘foo’:
return fooController(params)
}
}
透過 doGet, doPost 處理理 HTTP GET, HTTP post 請求
function fooController(params){
Do something
Call Model for stored data
return HtmlService.createTemplateFromFile(‘fooView')
}
function barController(params){
Do something
Call Model for stored data
return HtmlService.createTemplateFromFile(‘barView’)
}
Route
Controller
Model View
G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 簡 單 的 ⼩小 S i d e P r o j e c t
G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 商 業 模 式 P r o t o t y p e
獵頭⼯工作⾃自動化系統
獵頭⼯工作⼀一直都是⼈人⼒力力密集的產業,通常需要很多⼈人⼯工 Keyin 資料,
收發信件,約 calendar 時間等等的聯聯絡⼯工作
透過 Google Form, Gmail 組合快速把獵頭的瑣碎⼯工作⾃自動化
配合 Glide App 打造出 Mobile Solution
獵頭⼯工作⾃自動化系統(⼤大約 20 hrs)
各種求職者資料表單
SpreadsheetApp
HtmlService
GmailApp.send
寄送求職者媒合信件
給各家徵才公司
塞進數據庫
Triggered by form
訪談 Feedback 表單
Triggered by form
⾃自動⽣生成履歷表
DocumentApp DriveApp
資料建檔
⼯工作⼈人員操作後台
Triggered by form
From Spreadsheet to Web App
G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 商 業 模 式 P r o t o t y p e
本⾝身有 GSuite 的權限管理理功能
只有同機構帳號可以 Access
業務後台
跌跌撞撞的各種踩坑
H m m m ⽅方 便便 歸 ⽅方 便便 , 還 是 有 點 美
中 不 ⾜足 的 地 ⽅方 嘛 ~ ~
不⾒見見得適合很嚴謹的⼤大型開發啦......
克 服 G o o g l e A p p s S c r i p t 的 缺 點
Function 時長限制(6 分鐘,30 分鐘)
Free Gmail Account (6 mins per task) G Suite Users (30 mins per task)
克 服 G o o g l e A p p s S c r i p t 的 缺 點
Function 時長限制(6 分鐘,30 分鐘)
var cache = CacheService.getScriptCache();
var cached = cache.get(“rss-feed-contents”);
cache.put("rss-feed-contents", contents, 1500); // cache for 25 minutes
Trigger 1 Trigger 2
Use cache
Trigger 設置只能到⼩小時
但是每天執⾏行行時間是固定的
GAS 有時候真的是
很慢...很慢...
克 服 G o o g l e A p p s S c r i p t 的 缺 點
遇到不能改的 User Agent ……
User-Agent: Mozilla/5.0 (compatible; GoogleDocs; script; +http://docs.google.com)

User-Agent: Mozilla/5.0 (compatible; Google-Apps-Script)
.

.

.
.
User-Agent,你今晚的惡惡夢
Mobile Web Only Q_Q
Apps Script
計画通り
克 服 G o o g l e A p p s S c r i p t 的 缺 點
不明原因的 Error 們
Spreadsheet 無法正常回應
「我們很抱歉」錯誤
1. 超出 Error Handling 的範圍,會需要⽤用多隻 Trigger 併⾏行行的⽅方式來來解決
2. 設定錯誤通知( Trigger 中可以設定⼀一有錯誤⾺馬上 Email 通知)
執⾏行行流程
Try & Catch
執⾏行行 Spreadsheet App
克 服 G o o g l e A p p s S c r i p t 的 缺 點
建立⼀一個好的開發環境
可以在取檔案名字時,
⽤用 “/” 來來創建資料夾了了!
使⽤用 Dark Mode 保護眼睛,告別葉黃素(誤)
⼀一鍵 push / pull 檔案到 GitHub remote
1. Google Apps Script 有免費,不⽤用處理理 Server,可以⽤用
Spreadsheet 等特點,非常⽤用來來適合做簡單⼩小 Side

2. 透過 Google Apps Script 可以輕易易連結起 Gmail, Google
Drive, Docs, Form, Translate 等 GSuite 服務,還可以
host 網⾴頁,開 API 等,很適合⽤用來來做辦公室的 RPA ⼯工具

3. Google Apps Script 雖然有不少限制,不過正快速發展中
總結
⽤用 G o o g l e A p p s S c r i p t 挑 戰 輕 鬆 R P A
我到底都看了了些什什麼?

Mais conteúdo relacionado

Destaque

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 

Destaque (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

用 Google Apps Script 挑戰輕鬆 RPA,工作雜事自動化,實踐辦公室的,構!造!改!革!

  • 1. ⼯工 作 雜 事 ⾃自 動 化 , 實 踐 辦 公 室 構 ! 造 ! 改 ! ⾰革 ! By Adrian Wu ⽤用 Google Apps Script 挑戰輕鬆 RPA
  • 2. 1. RPA 概念念與⾃自動化的難題 2. Google Apps Script 的優勢 3. 開發案例例分享 • 業務流程⾃自動化(⾃自動產⽣生給客⼾戶的成效報表) • 報名系統⾃自動化(⾃自動回信,資料整合) • 股票盯盤(⾃自動抓10多個網站的資訊,⾃自動通知) 4. 活⽤用 GAS 提升穩定性 ⼤大綱 ⽤用 G o o g l e A p p s S c r i p t 挑 戰 輕 鬆 R P A 推廣利利⽤用 Google Apps Script 來來實踐辦公室 RPA,讓繁瑣 ⼯工作⾃自動化,提升⼯工作效率!
  • 3. RPA 概念念與⾃自動化的難題 如 果 可 以 , 我 也 想 要 躺 著 ⼯工 作 R r r
  • 5. 你是否有聽過類似的都市傳說呢? R P A 概 念念 與 ⾃自 動 化 的 難 題
  • 6. 什什麼是 RPA (Robotic Process Automation) ? R P A 概 念念 與 ⾃自 動 化 的 難 題 流程機器⼈人(Robotic Process Automation, RPA) 
 是⼀一種⽤用來來將辦公室電腦作業,反覆執⾏行行的瑣碎流程,轉為⾃自動化的軟體。 它類似於電腦桌⾯面上有⼀一個虛擬⾃自動的⼿手,專⾨門⽤用來來處理理⼀一些有規則性、很 機械化、但⼜又⾼高準確率要求的重複性動作
  • 7. 什什麼是 RPA (Robotic Process Automation) ? R P A 概 念念 與 ⾃自 動 化 的 難 題
  • 8. 什什麼是 RPA (Robotic Process Automation) ? R P A 概 念念 與 ⾃自 動 化 的 難 題 那麼......這麼好的東⻄西要怎麼開始呢? Where to start?
  • 9. 標準 RPA Side Project 專案流程圖 R P A 概 念念 與 ⾃自 動 化 的 難 題 我有⼀個 ⼤膽的想法 忙,是治療⼀切 精神病的良藥 ⼈⽣已經 如此艱難 吹呀吹呀 我的驕傲放縱 Deploy Server EnvironmentDatabase rollback Server Cost DB server
  • 10. Apps Script Many Google apps, one platform in the cloud
  • 11. Google Apps Script (GAS) Many Google apps, one platform in the cloud
  • 12. G o o g l e A p p s S c r i p t 介 紹 透過 Spreadsheet 直接充當資料庫, 在服務前期,資料格式不確定時,可避 免調整資料庫的⿇麻煩,達到快速開發 可以透過 Spreadsheet 儲存 ⼤大多數功能可以在 Google Apps Script 免費額度中完成,⽽而且如果是 GSuite 的話,還能獲得進⼀一步擴充! ⼤大抵上免費 GAS 是⼀一個 serverless 服務,開發者 無須處理理伺服器,也沒有環境問題, 所有服務直接運⾏行行在 Google 雲端上 無需處理理 Server side GAS 可以呼叫許多常⽤用的 Google 服務, 很多功能都無需另外建置,⽽而且無痛整合 GSuite 功能,非常適合⽣生產⼒力力⼯工具開發 連動 Google 服務 GAS 非常適合⽤用來來開發簡單服務 or GSuite related service Latest Update:June 12, 2020
  • 13. G o o g l e A p p s S c r i p t 介 紹 要能夠躺著⼯工作,我會需要什什麼功能? 午餐機器⼈人為例例: Input Output Magic Million Dollar Idea!!!
  • 14. G o o g l e A p p s S c r i p t 介 紹 要能夠躺著⼯工作,我會需要什什麼功能? 午餐機器⼈人為例例: Input Output Magic Interface Interface Database
  • 15. G o o g l e A p p s S c r i p t 介 紹 要能夠躺著⼯工作,我會需要什什麼功能? 午餐機器⼈人為例例: Input Output Magic Interface Interface Database Server
  • 16. G o o g l e A p p s S c r i p t 介 紹 要能夠躺著⼯工作,我會需要什什麼功能? 午餐機器⼈人為例例: Input Output Magic Interface Interface Database Production Server Development Server Deploy
  • 17. G o o g l e A p p s S c r i p t 介 紹 要能夠躺著⼯工作,我會需要什什麼功能? 午餐機器⼈人為例例: Input Output Magic Spreadsheet Interface Interface Focus Here!!
  • 18. G o o g l e A p p s S c r i p t 介 紹 要能夠躺著⼯工作,我會需要什什麼功能? Input Output Magic HtmlService / Google Form / API HtmlOutput / TextOutput + Google Site Spreadsheet + Glide App => pwa Spreadsheet Cloud SQL BigQuery doGet function doPost function Trigger by event, by time
  • 19. 努⼒力力對抗無聊的 Routine Work G o o g l e A p p s S c r i p t 開 發 案 例例
  • 20. G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 簡 化 ⼯工 作 流 程 ⾃自動化數據報表 每天都要⽣生⼀一堆數據報表給各家客⼾戶, 不但要⼿手動去網站抓資料,還要再⼈人⼯工 Key 成⽂文件,再寄出 ⾃自動從服務中抓取今天的數據,⾃自動整理理並寫入⽂文件, 做成最後報告(還可以⾃自動寄給客⼾戶!)
  • 21. 廣告服務的⾃自動化報表(⼤大約 5-6 hrs) 廣告聯聯播網(Ad Network) Web 廣告投放平台(SSP) App 廣告投放平台(SSP) 有報表 無報表 GmailApp.search BigQuery.Jobs.query 按客⼾戶訂單分配 + 處理理資料 DriveApp.makeCopy(template) SpreadsheetApp HtmlService GmailApp.send DriveApp 寄給客⼾戶 塞進精美表單 資料留留檔 or UrlFetchApp Triggered at 10 ~ 11 am daily G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 簡 化 ⼯工 作 流 程
  • 22. G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 簡 單 的 ⼩小 S i d e P r o j e c t ⾃自動股票盯盤 每天都要花時間盯股票走勢,希望⼀一次可以追蹤⼤大量量股票, ⽽而且同時紀錄不同網站上⾯面蒐集到的各種數據分析 每天⾃自動爬 300 多隻股票,5000 多個網⾴頁的資料, 把相關的信號分析都跑⼀一遍,⽽而且⾃自動寄信通知美⽇日⾏行行情, 然後做成⼀一個簡單網站提供觀察
  • 23. 股票資料搜集爬蟲(第⼀一版,1 weekend) 美股數據網站 每天抓取超過 5000 多個網⾴頁 的股票數據 SpreadsheetApp HtmlService GmailApp.send DriveApp 寄送每⽇日股票數據 塞進表單 資料留留檔 UrlFetchApp Triggered at 5 am daily 台股數據網站 總經數據網站 股票新聞網站 每⽇日資料比對 每⽇日估值模型計算 產出簡單網⾴頁 HtmlService 透過 Google Site 組成簡單網站 同⼀一個 Trigger 內,連續 UrlFetch 時 GAS 會有 6-7 個 IP 輪輪流替換 Bootstrap, jQuery, Vue.js, D3.js 等 可以透過 CDN ⽅方式匯入 可以直接嵌⼀一個 iframe 上去 G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 簡 單 的 ⼩小 S i d e P r o j e c t Google Finance API
  • 24. ⽤用 Google Apps Script 當作網⾴頁後端 function doGet(e){ switch(e.parameter.mode){ case ‘foo’: return fooController(params) } } 透過 doGet, doPost 處理理 HTTP GET, HTTP post 請求 function fooController(params){ Do something Call Model for stored data return HtmlService.createTemplateFromFile(‘fooView') } function barController(params){ Do something Call Model for stored data return HtmlService.createTemplateFromFile(‘barView’) } Route Controller Model View G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 簡 單 的 ⼩小 S i d e P r o j e c t
  • 25. G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 商 業 模 式 P r o t o t y p e 獵頭⼯工作⾃自動化系統 獵頭⼯工作⼀一直都是⼈人⼒力力密集的產業,通常需要很多⼈人⼯工 Keyin 資料, 收發信件,約 calendar 時間等等的聯聯絡⼯工作 透過 Google Form, Gmail 組合快速把獵頭的瑣碎⼯工作⾃自動化 配合 Glide App 打造出 Mobile Solution
  • 26. 獵頭⼯工作⾃自動化系統(⼤大約 20 hrs) 各種求職者資料表單 SpreadsheetApp HtmlService GmailApp.send 寄送求職者媒合信件 給各家徵才公司 塞進數據庫 Triggered by form 訪談 Feedback 表單 Triggered by form ⾃自動⽣生成履歷表 DocumentApp DriveApp 資料建檔 ⼯工作⼈人員操作後台 Triggered by form From Spreadsheet to Web App G o o g l e A p p s S c r i p t S i d e P r o j e c t 案 例例 - 商 業 模 式 P r o t o t y p e 本⾝身有 GSuite 的權限管理理功能 只有同機構帳號可以 Access 業務後台
  • 27.
  • 28. 跌跌撞撞的各種踩坑 H m m m ⽅方 便便 歸 ⽅方 便便 , 還 是 有 點 美 中 不 ⾜足 的 地 ⽅方 嘛 ~ ~
  • 30. 克 服 G o o g l e A p p s S c r i p t 的 缺 點 Function 時長限制(6 分鐘,30 分鐘) Free Gmail Account (6 mins per task) G Suite Users (30 mins per task)
  • 31. 克 服 G o o g l e A p p s S c r i p t 的 缺 點 Function 時長限制(6 分鐘,30 分鐘) var cache = CacheService.getScriptCache(); var cached = cache.get(“rss-feed-contents”); cache.put("rss-feed-contents", contents, 1500); // cache for 25 minutes Trigger 1 Trigger 2 Use cache Trigger 設置只能到⼩小時 但是每天執⾏行行時間是固定的 GAS 有時候真的是 很慢...很慢...
  • 32. 克 服 G o o g l e A p p s S c r i p t 的 缺 點 遇到不能改的 User Agent …… User-Agent: Mozilla/5.0 (compatible; GoogleDocs; script; +http://docs.google.com)
 User-Agent: Mozilla/5.0 (compatible; Google-Apps-Script) .
 .
 . . User-Agent,你今晚的惡惡夢 Mobile Web Only Q_Q Apps Script 計画通り
  • 33. 克 服 G o o g l e A p p s S c r i p t 的 缺 點 不明原因的 Error 們 Spreadsheet 無法正常回應 「我們很抱歉」錯誤 1. 超出 Error Handling 的範圍,會需要⽤用多隻 Trigger 併⾏行行的⽅方式來來解決 2. 設定錯誤通知( Trigger 中可以設定⼀一有錯誤⾺馬上 Email 通知) 執⾏行行流程 Try & Catch 執⾏行行 Spreadsheet App
  • 34. 克 服 G o o g l e A p p s S c r i p t 的 缺 點 建立⼀一個好的開發環境 可以在取檔案名字時, ⽤用 “/” 來來創建資料夾了了! 使⽤用 Dark Mode 保護眼睛,告別葉黃素(誤) ⼀一鍵 push / pull 檔案到 GitHub remote
  • 35. 1. Google Apps Script 有免費,不⽤用處理理 Server,可以⽤用 Spreadsheet 等特點,非常⽤用來來適合做簡單⼩小 Side
 2. 透過 Google Apps Script 可以輕易易連結起 Gmail, Google Drive, Docs, Form, Translate 等 GSuite 服務,還可以 host 網⾴頁,開 API 等,很適合⽤用來來做辦公室的 RPA ⼯工具
 3. Google Apps Script 雖然有不少限制,不過正快速發展中 總結 ⽤用 G o o g l e A p p s S c r i p t 挑 戰 輕 鬆 R P A 我到底都看了了些什什麼?