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

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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)
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - 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