Google Apps Script – 100 Question Quiz

✅ Google Apps Script – 100 Question Quiz

With Detailed Answers & Explanations


🟢 SECTION 1: Google Apps Script Fundamentals (1–20)


1. What is Google Apps Script?

Answer:
Google Apps Script is a cloud-based JavaScript platform used to automate, extend, and integrate Google Workspace apps.

Explanation:
It runs on Google’s servers and allows you to write JavaScript that interacts with services like Google Sheets, Docs, Gmail, Drive, and external APIs—without needing to manage servers.


2. Which JavaScript version does Apps Script use?

Answer:
Modern JavaScript (ECMAScript 2020+).

Explanation:
Apps Script supports modern JS features like let, const, arrow functions, classes, template literals, and async/await.


3. Where is Google Apps Script code executed?

Answer:
On Google’s servers (cloud-based execution).

Explanation:
This allows scripts to run without user machines being online and enables triggers, automation, and scalability.


4. What file extension is used for Apps Script files?

Answer:
.gs

Explanation:
.gs files are treated as JavaScript but include Apps Script services and environment features.


5. How do you open Apps Script from Google Sheets?

Answer:
Extensions → Apps Script

Explanation:
This opens a script project bound to the spreadsheet.


6. What is a “bound script”?

Answer:
A script attached to a specific Google file.

Explanation:
Bound scripts can directly access their container (Sheet, Doc, Form) without explicit IDs.


7. What is a “standalone script”?

Answer:
A script not attached to a specific Google file.

Explanation:
Standalone scripts can interact with multiple files using IDs and are reusable.


8. What function runs automatically when a script is executed manually?

Answer:
Any named function (commonly main() or myFunction()).

Explanation:
Apps Script does not require a special main function—any function can be run manually.


9. How do you log output for debugging?

Answer:
Logger.log()

Explanation:
Logs can be viewed via Executions → Logs or View → Logs.


10. What does console.log() do in Apps Script?

Answer:
Logs output to the execution log (similar to Logger).

Explanation:
Modern Apps Script supports console logging, useful for debugging.


11. What is the maximum execution time for consumer Apps Script?

Answer:
6 minutes.

Explanation:
Time-based limits prevent long-running scripts from consuming excessive resources.


12. What authorization model does Apps Script use?

Answer:
OAuth 2.0

Explanation:
Users must explicitly grant permissions when scripts access their data.


13. What happens when a script needs new permissions?

Answer:
The user is prompted to re-authorize.

Explanation:
This ensures transparency and security.


14. What is Utilities.sleep() used for?

Answer:
Pausing script execution.

Explanation:
Commonly used to avoid rate limits or allow time for external processes.


15. What is a trigger?

Answer:
A rule that automatically runs a script.

Explanation:
Triggers allow automation without manual execution.


16. Name two types of triggers.

Answer:
Simple triggers and installable triggers.

Explanation:
Simple triggers run automatically; installable triggers require authorization.


17. Can Apps Script access external APIs?

Answer:
Yes.

Explanation:
Using UrlFetchApp.fetch() to make HTTP requests.


18. What is the default timezone of Apps Script?

Answer:
The project’s timezone (configurable).

Explanation:
Timezone affects triggers, dates, and scheduling.


19. What editor is used for Apps Script?

Answer:
The Google Apps Script IDE.

Explanation:
It includes debugging, executions history, and triggers.


20. Can Apps Script be used outside Google Workspace?

Answer:
Yes.

Explanation:
Apps Script can interact with external APIs and services.


🟡 SECTION 2: Google Sheets & Data Handling (21–45)


21. How do you access a spreadsheet?

Answer:
SpreadsheetApp.openById() or getActiveSpreadsheet()

Explanation:
Active spreadsheet works for bound scripts; IDs are needed for others.


22. How do you select a sheet by name?

Answer:
getSheetByName("Sheet1")


23. How do you read a cell value?

Answer:
getRange("A1").getValue()


24. How do you write a value to a cell?

Answer:
setValue(value)


25. Why is getValues() preferred over looping getValue()?

Answer:
Performance.

Explanation:
Batch operations drastically reduce execution time.


26. What data type does getValues() return?

Answer:
A 2D array.


27. How do you append a row?

Answer:
appendRow([])


28. How do you clear a sheet?

Answer:
clear() or clearContents()


29. How do you get the last row with data?

Answer:
getLastRow()


30. How do you protect a sheet?

Answer:
protect()


31. What is a named range?

Answer:
A reusable reference to a cell range.


32. How do you format a cell?

Answer:
Using methods like setFontWeight(), setBackground().


33. How do you insert a formula?

Answer:
setFormula()


34. What happens if you write formulas with setValues()?

Answer:
They must be written as strings starting with =.


35. How do you sort data?

Answer:
sort()


36. How do you filter data?

Answer:
createFilter()


37. What is a spreadsheet trigger?

Answer:
A trigger responding to spreadsheet events.


38. What does onEdit(e) do?

Answer:
Runs when a user edits a sheet.


39. Can onEdit() access Gmail?

Answer:
No.

Explanation:
Simple triggers have restricted permissions.


40. How do you avoid permission limits?

Answer:
Use installable triggers.


41. What is e.range?

Answer:
The edited cell range.


42. How do you prevent infinite loops?

Answer:
Check conditions before writing data.


43. What is flush() used for?

Answer:
Forcing pending changes to apply.


44. Can Apps Script handle large datasets?

Answer:
Yes, with batching.


45. Best practice for reading sheets?

Answer:
Read once, process in memory, write once.


🔵 SECTION 3: Gmail, Drive, Docs & Automation (46–70)


46. How do you send an email?

Answer:
GmailApp.sendEmail()


47. Difference between GmailApp and MailApp?

Answer:
GmailApp supports threads and labels.


48. How do you access Google Drive files?

Answer:
DriveApp


49. How do you create a folder?

Answer:
DriveApp.createFolder()


50. How do you read a Google Doc?

Answer:
DocumentApp.openById()


51. How do you insert text into a Doc?

Answer:
appendParagraph()


52. How do you replace text in a Doc?

Answer:
replaceText()


53. How do you create a PDF?

Answer:
Using getAs("application/pdf")


54. Can Apps Script create Forms?

Answer:
Yes.


55. How do you add questions to Forms?

Answer:
Using FormApp


56. What is automation best used for?

Answer:
Repeating tasks and workflows.


57. How do you schedule tasks?

Answer:
Time-driven triggers.


58. What is batch emailing?

Answer:
Sending multiple emails programmatically.


59. What is a quota?

Answer:
Usage limits per day or execution.


60. What happens if quotas are exceeded?

Answer:
Script fails.


61. Can Apps Script run nightly jobs?

Answer:
Yes.


62. Can it generate reports automatically?

Answer:
Yes.


63. Can it read PDFs?

Answer:
Limited—requires OCR or APIs.


64. Can it integrate with Slack?

Answer:
Yes, via webhooks.


65. Can Apps Script build web apps?

Answer:
Yes.


66. What method outputs HTML?

Answer:
HtmlService.createHtmlOutput()


67. Can web apps use JavaScript?

Answer:
Yes (client + server).


68. How does client-server communication work?

Answer:
google.script.run


69. Are web apps secure by default?

Answer:
Depends on access settings.


70. Best use of Apps Script web apps?

Answer:
Internal tools and dashboards.


🔴 SECTION 4: Advanced Concepts & Best Practices (71–100)


71. What is V8 runtime?

Answer:
Modern JavaScript engine for Apps Script.


72. Why use const and let?

Answer:
Block scoping and safer code.


73. What is asynchronous behavior in Apps Script?

Answer:
Limited; mostly synchronous.


74. What is error handling?

Answer:
Managing runtime errors.


75. How do you catch errors?

Answer:
try...catch


76. What is defensive coding?

Answer:
Writing code to handle unexpected inputs.


77. What is version control in Apps Script?

Answer:
Script versions and GitHub integration.


78. Can Apps Script connect to GitHub?

Answer:
Yes (via clasp).


79. What is clasp?

Answer:
Command-line tool for Apps Script.


80. Why use clasp?

Answer:
Local development and version control.


81. What is modular code?

Answer:
Breaking code into reusable functions.


82. What is DRY?

Answer:
Don’t Repeat Yourself.


83. What is an execution log?

Answer:
A record of script runs.


84. What is a stack trace?

Answer:
Error execution path.


85. Can Apps Script use libraries?

Answer:
Yes.


86. What is a library?

Answer:
Reusable script code.


87. What is an add-on?

Answer:
Packaged Apps Script extension.


88. Difference between add-ons and scripts?

Answer:
Add-ons are installable by users.


89. Can Apps Script handle authentication?

Answer:
Yes (OAuth).


90. What is best practice for security?

Answer:
Least-privilege permissions.


91. How do you optimize performance?

Answer:
Batch operations.


92. What is a webhook?

Answer:
HTTP callback.


93. Can Apps Script act as a webhook receiver?

Answer:
Yes.


94. What is doGet()?

Answer:
Handles HTTP GET requests.


95. What is doPost()?

Answer:
Handles HTTP POST requests.


96. Can Apps Script be used for APIs?

Answer:
Yes.


97. How do you return JSON?

Answer:
ContentService.createTextOutput()


98. What is caching?

Answer:
Temporary data storage.


99. How do you cache data?

Answer:
CacheService


100. Best overall use of Google Apps Script?

Answer:
Automating workflows inside Google Workspace.

Explanation:
Apps Script shines at connecting tools, saving time, and enabling no-server automation.