SlideShare a Scribd company logo
1 of 38
Download to read offline
Google Apps Script

Simon Su
About me...
● Job:MiCloud RD Leader (http:
//micloud.tw)
● Skills:
○ Service Architecture
○ Node.js
○ Google Service
● Open Sources:
○ opennodes.arecord.us
○ peihsinsu.blogspot.tw
○ blog.micloud.tw
○ slideshare.net/peihsinsu
We are...
Cloud is Already Exists!
Cloud Changes the Developer
Few years ago
● system and os
● network setup
● install what I need
● mail sdk
● sms bridge
● backup and archive
● socket protocol
● building versioning
system for develop
● ...

Now
● cloud machine
● vpc and permission
● software preload
● email service
● sms service
● object storage
● restful protocal
● git deploy & github
in the world
● ...
Our Topic
What does
Simple Business in the Cloud need?
Most Small Service Needs:
OA + Landing Page + REST Services
What is Apps Script?!
Apps Script Serves
By Type
● Standalone Scripts
● Container-Bound Scripts
By Function
● Spreadsheet Custom Functions
● Web Apps
● Google Sites Gadgets
● Container Extensions
API Supports
● Google Apps
Services
● Calendar
● Contacts
● DocsList
● Document
● Domain
● Drive

●
●
●
●
●
●
●
●

Finance
Forms
Gmail
Groups
Language
Maps
Sites
Spreadsheet
What you can do with Apps Script?

Monitor your Web

Google Form integrate

Build a RESTful endpoint
First Apps Script Service Monitor using Google Drive
● Idea
○ Using google sheet for data persistance
○ Using apps script UrlFetch to retrieve monitor target
resource

● Some Reference
○ http://gappsnews.blogspot.tw/2013/01/google-appsscript-http-monitor.html
○ http://gappsnews.blogspot.tw/2013/03/re-googlegoogle-apps-scriptgoogle-form.html
You will know...
● SpreadsheetApp.openById(...)
○ getSheetByName(...)
○ insertSheet(...)
○ appendRow(...)

● UrlFetchApp.fetch(...)
Piece of Code
Save data to sheet and setting chart
Web / Google Site Integrate
2nd Apps Script Google Form send notification
● Idea:
○ Send mail notify when form sent
○ Call remote rest when form sent
●

Some References:
○ http://gappsnews.blogspot.tw/2013/03/fwd-googleapps-script-event-object.html
○ http://gappsnews.blogspot.tw/2013/02/google-appsscriptgoogle-form.html
You will know...
● SpreadsheetApp.getActiveSheet()
● GmailApp.sendEmail(...)
● JSON
○ Object.keys(jsonObject)
○ JSON.stringify(jsonObject)
○ JSON.parse(string)
Create your form and result sheet

Live Form Editor
Create Script for Result Sheet
Piece of Code
function notify(){

function getLastRowTable(arr){

var sheet =

return jsonObjToTableWithTitle(arr[0],

SpreadsheetApp.getActiveSheet();

arr[arr.length-1]);

var rows = sheet.getDataRange();

}

var values = rows.getValues();

function jsonObjToTableWithTitle(title, row){

var content = getLastRowTable(values);

var TRs = '';

var htmlBody = "Hi Admin: <br/><br/>”+

var keys = Object.keys(row);

”有人填表拉,檢 查一下吧! <br/><br/>" +

for(var j = 0 ; j < keys.length ; j++) {

content +

var TR = '<tr>';

“<br/><br/>Send by Google Apps”;

var rowvalue = row[keys[j]];

GmailApp.sendEmail(

TR += ('<td>' + title[keys[j]] +

"your-mail@gmail.com",

'</td><td>' + rowvalue + '</td>' );

"Form Submit Confirm Notice",

TR+= '</tr>';

htmlBody,

TRs += TR;

{from: your-mail@gmail.com,

}

htmlBody:htmlBody}

var table = '<table border="1px">' +

);
}

TRs +'</table>';
return table;
Create the form submit event trigger
Test your form
3rd Apps Script Build a RESTful Service
● Idea
○ The advance interactive to all clients

● Restrictions
○ base url is fixed, only query and form as patameter
can be the input
○ get, post method only (2013.7.21)
○ need solve the HTTP CODE: 302 problem

● Some Reference
○ http://gappsnews.blogspot.tw/2013/07/apps-scriptwith-restful.html
○ http://gappsnews.blogspot.tw/2013/07/fwd-appsscript.html
○ http://gappsnews.blogspot.tw/2013/07/apps-script-
You will know...
● doGet()
● ContentService.createTextOutput(...)
Demo of Using RESTful
Piece of Code
Deploy & Publish
Testing in curl

URL Pattern:https://script.google.
com/macros/s/:id/exec

Script ID
Testing in Advance REST Client
Testing in
Ajax Code...
Thinking in different...
● Drive application integrate related,
scheduling, data present and interactive...
● Static page service (Github Page, Cloud
CMS) interactive...
● Mobile devices' remote thin app server, to be
a RDB, NDB, BigQuery... middleware
● The chrome extension server side...
Chrome Web Store Connect
Script Gallery
Quota of Apps Script
Other Features Connect to Google Services
● Google Apps
○ Document extension
○ Simple form services

● Google Cloud Platform
○ BigQuery integrate
○ ScriptDB

● External Services
○ Connect with JDBC
Reference
● Apps Script Example: https://developers.
google.com/apps-script/case-studies
● Sunset Scripts: https://developers.google.
com/apps-script/sunset
Q&A
Slideshare: http://www.slideshare.net/peihsinsu/google-apps-script-24469585

More Related Content

What's hot

Grails Simple Login
Grails Simple LoginGrails Simple Login
Grails Simple Login
moniguna
 

What's hot (20)

GraphQL - an elegant weapon... for more civilized age
GraphQL - an elegant weapon... for more civilized ageGraphQL - an elegant weapon... for more civilized age
GraphQL - an elegant weapon... for more civilized age
 
Why Grails?
Why Grails?Why Grails?
Why Grails?
 
[GCP Summit 2018] Kubernetes with Nginx and Elasticsearch on GCP
[GCP Summit 2018] Kubernetes with Nginx and Elasticsearch on GCP[GCP Summit 2018] Kubernetes with Nginx and Elasticsearch on GCP
[GCP Summit 2018] Kubernetes with Nginx and Elasticsearch on GCP
 
A Beginner's Guide to Building Data Pipelines with Luigi
A Beginner's Guide to Building Data Pipelines with LuigiA Beginner's Guide to Building Data Pipelines with Luigi
A Beginner's Guide to Building Data Pipelines with Luigi
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Hadoop Conf 2014 - Hadoop BigQuery Connector
Hadoop Conf 2014 - Hadoop BigQuery ConnectorHadoop Conf 2014 - Hadoop BigQuery Connector
Hadoop Conf 2014 - Hadoop BigQuery Connector
 
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScriptMongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
 
VMWorld 2017 Hackathon training: Getting Started with Clarity
VMWorld 2017 Hackathon training: Getting Started with ClarityVMWorld 2017 Hackathon training: Getting Started with Clarity
VMWorld 2017 Hackathon training: Getting Started with Clarity
 
How AngularDart & Firebase did an App together
How AngularDart & Firebase did an App togetherHow AngularDart & Firebase did an App together
How AngularDart & Firebase did an App together
 
GraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchGraphQL & Prisma from Scratch
GraphQL & Prisma from Scratch
 
A real-world Relay application in production - Stefano Masini - Codemotion Am...
A real-world Relay application in production - Stefano Masini - Codemotion Am...A real-world Relay application in production - Stefano Masini - Codemotion Am...
A real-world Relay application in production - Stefano Masini - Codemotion Am...
 
Grails Simple Login
Grails Simple LoginGrails Simple Login
Grails Simple Login
 
TDC São Paulo 2015 Ruby - Crescimento e performance em uma aplicação em Rails
TDC São Paulo 2015 Ruby - Crescimento e performance em uma aplicação em RailsTDC São Paulo 2015 Ruby - Crescimento e performance em uma aplicação em Rails
TDC São Paulo 2015 Ruby - Crescimento e performance em uma aplicação em Rails
 
[MongoDB.local Bengaluru 2018] Just in Time Validation with JSON Schema
[MongoDB.local Bengaluru 2018] Just in Time Validation with JSON Schema[MongoDB.local Bengaluru 2018] Just in Time Validation with JSON Schema
[MongoDB.local Bengaluru 2018] Just in Time Validation with JSON Schema
 
Enhanced site search with cognitive APIs - Glynn Bird
Enhanced site search with cognitive APIs - Glynn BirdEnhanced site search with cognitive APIs - Glynn Bird
Enhanced site search with cognitive APIs - Glynn Bird
 
Introduction to PiCloud
Introduction to PiCloudIntroduction to PiCloud
Introduction to PiCloud
 
MongoDB Aggregation
MongoDB Aggregation MongoDB Aggregation
MongoDB Aggregation
 
Liquid Stream Processing Across Web Browsers and Web Servers
Liquid Stream Processing Across Web Browsers and Web ServersLiquid Stream Processing Across Web Browsers and Web Servers
Liquid Stream Processing Across Web Browsers and Web Servers
 
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
 
Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1
 

Viewers also liked

Libraries in the_cloud_mnlib11
Libraries in the_cloud_mnlib11Libraries in the_cloud_mnlib11
Libraries in the_cloud_mnlib11
donovan_lambright
 
Fzi Karlsruhe - Social Applications In The Cloud
Fzi Karlsruhe - Social Applications In The CloudFzi Karlsruhe - Social Applications In The Cloud
Fzi Karlsruhe - Social Applications In The Cloud
Patrick Chanezon
 
Clould Computing and its application in Libraries
Clould Computing and its application in LibrariesClould Computing and its application in Libraries
Clould Computing and its application in Libraries
Amit Shaw
 

Viewers also liked (20)

Google Apps Script: The Authentic{ated} Playground
Google Apps Script: The Authentic{ated} PlaygroundGoogle Apps Script: The Authentic{ated} Playground
Google Apps Script: The Authentic{ated} Playground
 
Google apps script introduction
Google apps script introductionGoogle apps script introduction
Google apps script introduction
 
Google apps script - Parte 2
Google apps script - Parte 2Google apps script - Parte 2
Google apps script - Parte 2
 
INTRODUCTION A GOOGLE SCRIPT [SLI]
INTRODUCTION A GOOGLE SCRIPT [SLI]INTRODUCTION A GOOGLE SCRIPT [SLI]
INTRODUCTION A GOOGLE SCRIPT [SLI]
 
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
Google Technical Webinar - Building Mashups with Google Apps and SAP, using S...
 
Google apps для бизнеса
Google apps для бизнесаGoogle apps для бизнеса
Google apps для бизнеса
 
Вадим Зубович - Sikuli script - идеальный инструмент для обучения автоматизации
Вадим Зубович - Sikuli script - идеальный инструмент для обучения автоматизацииВадим Зубович - Sikuli script - идеальный инструмент для обучения автоматизации
Вадим Зубович - Sikuli script - идеальный инструмент для обучения автоматизации
 
Créer un formulaire avec Google Forms - Office de Tourisme Val de Cher Saint-...
Créer un formulaire avec Google Forms - Office de Tourisme Val de Cher Saint-...Créer un formulaire avec Google Forms - Office de Tourisme Val de Cher Saint-...
Créer un formulaire avec Google Forms - Office de Tourisme Val de Cher Saint-...
 
Gmao
GmaoGmao
Gmao
 
Libraries in the_cloud_mnlib11
Libraries in the_cloud_mnlib11Libraries in the_cloud_mnlib11
Libraries in the_cloud_mnlib11
 
Google App Engine - Portland Java User Group - August 18 2009
Google App Engine - Portland Java User Group - August 18 2009Google App Engine - Portland Java User Group - August 18 2009
Google App Engine - Portland Java User Group - August 18 2009
 
Portugalpresentation 110624121924 Phpapp01
Portugalpresentation 110624121924 Phpapp01Portugalpresentation 110624121924 Phpapp01
Portugalpresentation 110624121924 Phpapp01
 
Fzi Karlsruhe - Social Applications In The Cloud
Fzi Karlsruhe - Social Applications In The CloudFzi Karlsruhe - Social Applications In The Cloud
Fzi Karlsruhe - Social Applications In The Cloud
 
Cloud Learning Environments - Google Apps UK User Group
Cloud Learning Environments - Google Apps UK User GroupCloud Learning Environments - Google Apps UK User Group
Cloud Learning Environments - Google Apps UK User Group
 
SaaS Presentation
SaaS PresentationSaaS Presentation
SaaS Presentation
 
SaaS Presentation at SCIT Conference
SaaS Presentation at SCIT ConferenceSaaS Presentation at SCIT Conference
SaaS Presentation at SCIT Conference
 
SaaS: Introduction
SaaS: IntroductionSaaS: Introduction
SaaS: Introduction
 
Clould Computing and its application in Libraries
Clould Computing and its application in LibrariesClould Computing and its application in Libraries
Clould Computing and its application in Libraries
 
А давайте будем многопоточить и масштабировить! - записки сумасшедшего №0
А давайте будем многопоточить и масштабировить! - записки сумасшедшего №0А давайте будем многопоточить и масштабировить! - записки сумасшедшего №0
А давайте будем многопоточить и масштабировить! - записки сумасшедшего №0
 
Cloud Computing for Education & Learning.
Cloud Computing for Education & Learning.Cloud Computing for Education & Learning.
Cloud Computing for Education & Learning.
 

Similar to Google apps script

Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
維佋 唐
 

Similar to Google apps script (20)

Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Utilising the data attribute
Utilising the data attributeUtilising the data attribute
Utilising the data attribute
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptGoogle Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScript
 
Domain Driven Design Tactical Patterns
Domain Driven Design Tactical PatternsDomain Driven Design Tactical Patterns
Domain Driven Design Tactical Patterns
 
UNIT 1 (7).pptx
UNIT 1 (7).pptxUNIT 1 (7).pptx
UNIT 1 (7).pptx
 
Building a Sustainable Data Platform on AWS
Building a Sustainable Data Platform on AWSBuilding a Sustainable Data Platform on AWS
Building a Sustainable Data Platform on AWS
 
5 x HTML5 worth using in APEX (5)
5 x HTML5 worth using in APEX (5)5 x HTML5 worth using in APEX (5)
5 x HTML5 worth using in APEX (5)
 
Dartprogramming
DartprogrammingDartprogramming
Dartprogramming
 
Spicy javascript: Create your first Chrome extension for web analytics QA
Spicy javascript: Create your first Chrome extension for web analytics QASpicy javascript: Create your first Chrome extension for web analytics QA
Spicy javascript: Create your first Chrome extension for web analytics QA
 
Introducere in web
Introducere in webIntroducere in web
Introducere in web
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScript
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
 
Building a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless frameworkBuilding a serverless company on AWS lambda and Serverless framework
Building a serverless company on AWS lambda and Serverless framework
 
RMLL 2013 - Synchronize OpenLDAP and Active Directory with LSC
RMLL 2013 - Synchronize OpenLDAP and Active Directory with LSCRMLL 2013 - Synchronize OpenLDAP and Active Directory with LSC
RMLL 2013 - Synchronize OpenLDAP and Active Directory with LSC
 
202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP
 
Future of Serverless
Future of ServerlessFuture of Serverless
Future of Serverless
 
Max euro python 2015
Max euro python 2015Max euro python 2015
Max euro python 2015
 
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
 
Leave your Room behind - UA Mobile 2019
Leave your Room behind - UA Mobile 2019Leave your Room behind - UA Mobile 2019
Leave your Room behind - UA Mobile 2019
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 

More from Simon Su

More from Simon Su (20)

Kubernetes Basic Operation
Kubernetes Basic OperationKubernetes Basic Operation
Kubernetes Basic Operation
 
Google IoT Core 初體驗
Google IoT Core 初體驗Google IoT Core 初體驗
Google IoT Core 初體驗
 
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoTJSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
JSDC 2017 - 使用google cloud 從雲到端,動手刻個IoT
 
GCPUG.TW meetup #28 - GKE上運作您的k8s服務
GCPUG.TW meetup #28 - GKE上運作您的k8s服務GCPUG.TW meetup #28 - GKE上運作您的k8s服務
GCPUG.TW meetup #28 - GKE上運作您的k8s服務
 
Google Cloud Platform Special Training
Google Cloud Platform Special TrainingGoogle Cloud Platform Special Training
Google Cloud Platform Special Training
 
GCE Windows Serial Console Usage Guide
GCE Windows Serial Console Usage GuideGCE Windows Serial Console Usage Guide
GCE Windows Serial Console Usage Guide
 
GCPNext17' Extend 開始GCP了嗎?
GCPNext17' Extend   開始GCP了嗎?GCPNext17' Extend   開始GCP了嗎?
GCPNext17' Extend 開始GCP了嗎?
 
Try Cloud Spanner
Try Cloud SpannerTry Cloud Spanner
Try Cloud Spanner
 
Google Cloud Monitoring
Google Cloud MonitoringGoogle Cloud Monitoring
Google Cloud Monitoring
 
Google Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKEGoogle Cloud Computing compares GCE, GAE and GKE
Google Cloud Computing compares GCE, GAE and GKE
 
JCConf 2016 - Google Dataflow 小試
JCConf 2016 - Google Dataflow 小試JCConf 2016 - Google Dataflow 小試
JCConf 2016 - Google Dataflow 小試
 
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop LabsJCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
 
JCConf2016 - Dataflow Workshop Setup
JCConf2016 - Dataflow Workshop SetupJCConf2016 - Dataflow Workshop Setup
JCConf2016 - Dataflow Workshop Setup
 
GCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow IntroductionGCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow Introduction
 
Brocade - Stingray Application Firewall
Brocade - Stingray Application FirewallBrocade - Stingray Application Firewall
Brocade - Stingray Application Firewall
 
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
使用 Raspberry pi + fluentd + gcp cloud logging, big query 做iot 資料搜集與分析
 
Docker in Action
Docker in ActionDocker in Action
Docker in Action
 
Google I/O 2016 Recap - Google Cloud Platform News Update
Google I/O 2016 Recap - Google Cloud Platform News UpdateGoogle I/O 2016 Recap - Google Cloud Platform News Update
Google I/O 2016 Recap - Google Cloud Platform News Update
 
IThome DevOps Summit - IoT、docker與DevOps
IThome DevOps Summit - IoT、docker與DevOpsIThome DevOps Summit - IoT、docker與DevOps
IThome DevOps Summit - IoT、docker與DevOps
 
Google Cloud Platform Introduction - 2016Q3
Google Cloud Platform Introduction - 2016Q3Google Cloud Platform Introduction - 2016Q3
Google Cloud Platform Introduction - 2016Q3
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Google apps script

  • 2. About me... ● Job:MiCloud RD Leader (http: //micloud.tw) ● Skills: ○ Service Architecture ○ Node.js ○ Google Service ● Open Sources: ○ opennodes.arecord.us ○ peihsinsu.blogspot.tw ○ blog.micloud.tw ○ slideshare.net/peihsinsu
  • 5. Cloud Changes the Developer Few years ago ● system and os ● network setup ● install what I need ● mail sdk ● sms bridge ● backup and archive ● socket protocol ● building versioning system for develop ● ... Now ● cloud machine ● vpc and permission ● software preload ● email service ● sms service ● object storage ● restful protocal ● git deploy & github in the world ● ...
  • 7. What does Simple Business in the Cloud need?
  • 8. Most Small Service Needs: OA + Landing Page + REST Services
  • 9. What is Apps Script?!
  • 10. Apps Script Serves By Type ● Standalone Scripts ● Container-Bound Scripts By Function ● Spreadsheet Custom Functions ● Web Apps ● Google Sites Gadgets ● Container Extensions
  • 11. API Supports ● Google Apps Services ● Calendar ● Contacts ● DocsList ● Document ● Domain ● Drive ● ● ● ● ● ● ● ● Finance Forms Gmail Groups Language Maps Sites Spreadsheet
  • 12. What you can do with Apps Script? Monitor your Web Google Form integrate Build a RESTful endpoint
  • 13. First Apps Script Service Monitor using Google Drive ● Idea ○ Using google sheet for data persistance ○ Using apps script UrlFetch to retrieve monitor target resource ● Some Reference ○ http://gappsnews.blogspot.tw/2013/01/google-appsscript-http-monitor.html ○ http://gappsnews.blogspot.tw/2013/03/re-googlegoogle-apps-scriptgoogle-form.html
  • 14. You will know... ● SpreadsheetApp.openById(...) ○ getSheetByName(...) ○ insertSheet(...) ○ appendRow(...) ● UrlFetchApp.fetch(...)
  • 16. Save data to sheet and setting chart
  • 17. Web / Google Site Integrate
  • 18. 2nd Apps Script Google Form send notification ● Idea: ○ Send mail notify when form sent ○ Call remote rest when form sent ● Some References: ○ http://gappsnews.blogspot.tw/2013/03/fwd-googleapps-script-event-object.html ○ http://gappsnews.blogspot.tw/2013/02/google-appsscriptgoogle-form.html
  • 19. You will know... ● SpreadsheetApp.getActiveSheet() ● GmailApp.sendEmail(...) ● JSON ○ Object.keys(jsonObject) ○ JSON.stringify(jsonObject) ○ JSON.parse(string)
  • 20. Create your form and result sheet Live Form Editor
  • 21. Create Script for Result Sheet
  • 22. Piece of Code function notify(){ function getLastRowTable(arr){ var sheet = return jsonObjToTableWithTitle(arr[0], SpreadsheetApp.getActiveSheet(); arr[arr.length-1]); var rows = sheet.getDataRange(); } var values = rows.getValues(); function jsonObjToTableWithTitle(title, row){ var content = getLastRowTable(values); var TRs = ''; var htmlBody = "Hi Admin: <br/><br/>”+ var keys = Object.keys(row); ”有人填表拉,檢 查一下吧! <br/><br/>" + for(var j = 0 ; j < keys.length ; j++) { content + var TR = '<tr>'; “<br/><br/>Send by Google Apps”; var rowvalue = row[keys[j]]; GmailApp.sendEmail( TR += ('<td>' + title[keys[j]] + "your-mail@gmail.com", '</td><td>' + rowvalue + '</td>' ); "Form Submit Confirm Notice", TR+= '</tr>'; htmlBody, TRs += TR; {from: your-mail@gmail.com, } htmlBody:htmlBody} var table = '<table border="1px">' + ); } TRs +'</table>'; return table;
  • 23. Create the form submit event trigger
  • 25. 3rd Apps Script Build a RESTful Service ● Idea ○ The advance interactive to all clients ● Restrictions ○ base url is fixed, only query and form as patameter can be the input ○ get, post method only (2013.7.21) ○ need solve the HTTP CODE: 302 problem ● Some Reference ○ http://gappsnews.blogspot.tw/2013/07/apps-scriptwith-restful.html ○ http://gappsnews.blogspot.tw/2013/07/fwd-appsscript.html ○ http://gappsnews.blogspot.tw/2013/07/apps-script-
  • 26. You will know... ● doGet() ● ContentService.createTextOutput(...)
  • 27. Demo of Using RESTful Piece of Code
  • 29. Testing in curl URL Pattern:https://script.google. com/macros/s/:id/exec Script ID
  • 30. Testing in Advance REST Client
  • 32. Thinking in different... ● Drive application integrate related, scheduling, data present and interactive... ● Static page service (Github Page, Cloud CMS) interactive... ● Mobile devices' remote thin app server, to be a RDB, NDB, BigQuery... middleware ● The chrome extension server side...
  • 33. Chrome Web Store Connect
  • 35. Quota of Apps Script
  • 36. Other Features Connect to Google Services ● Google Apps ○ Document extension ○ Simple form services ● Google Cloud Platform ○ BigQuery integrate ○ ScriptDB ● External Services ○ Connect with JDBC
  • 37. Reference ● Apps Script Example: https://developers. google.com/apps-script/case-studies ● Sunset Scripts: https://developers.google. com/apps-script/sunset