LEC 8 IOT Flashcards

(12 cards)

1
Q

What is Google Apps Script (GAS)?

A

part of google suite ( cloud- based automation platform)
Uses JavaScript for scripting.
ability to extend google apps functionality (docs, sheets etc)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the three main types of GAS?

A

Standalone – Stored in Google Drive and runs independently.
Bounded - Embedded to google workspace document
Web apps - Provides execution access via a web browser; standalone & bound scripts can be converted into web apps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the programming style of GAS?

A

Mainly JavaScript.
Uses camelCase for built-in objects and functions.
Object-oriented programming (OOP).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does a GAS Web App work

A

Client (browser, mobile, PC) sends requests and receives responses.
Server (Google Cloud) runs the script and processes requests.
Uses the concept callback:
“Call” = Sending code to the server.
“Callback” = The result sent back from the server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the two types of GAS deployment?

A

Test Deployment – Used for testing before actual release.
Actual Deployment – Generates a unique URL for web access.
Can be Private or Public.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the steps to create a Web App in GAS?

A

Write the script, including doGet(e) or doPost(e).
Activate via Test Deployment or Actual Deployment.
A unique URL is generated only after deployment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between doGet(e) and doPost(e)?

A

doGet(e): Handles GET requests (Fetching data).
Example use case: Displaying a webpage, retrieving data from Google Sheets.
doPost(e): Handles POST requests (Sending data).
Example use case: Submitting a form, storing IoT data in Google Sheets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Example of a simple Web App using GAS (doGet function)

A

function doGet(e) {
return ContentService.createTextOutput(“Hello, Web App!”);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Example of a Web App that stores IoT data in Google Sheets (doPost function)

A

function doPost(e) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var data = JSON.parse(e.postData.contents);
sheet.appendRow([data.time, data.temperature, data.humidity]);
return ContentService.createTextOutput(“Data Saved”);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the hierarchy of Google SpreadSheets in GAS?

A

Workbook → Worksheet → Cells
Uses A1 notation to access specific cells.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are some basic spreadsheet operations in GAS?

A

Get active spreadsheet:
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
Read from a cell:
var value = sheet.getRange(“A1”).getValue();
Logger.log(value);
Write to a cell:
sheet.getRange(“A1”).setValue(“New Data”);
Append data to a sheet:
sheet.appendRow([“Time”, “Temperature”, “Humidity”]);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the limitations of GAS?

A

Storage limitations – Limited execution time and storage space.
Server response time – Can have delays depending on workload.
Security restrictions – Only accepts secure connections.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly