Google Sheets Test Google Sheets Automation with Macros 3 — Questions and Answers
Question 1: A recorded macro is imported into another spreadsheet by:
- Copying its Apps Script function into that file's script editor (Correct answer)
- Emailing the .xlsm file
- Dragging the tab between windows
- Using Format > Paste macro
Correct answer: Copying its Apps Script function into that file's script editor
Macros travel with their Apps Script code, so you copy the function into the other file's editor.
Question 2: In the Apps Script editor, which service object is most commonly used to access the active spreadsheet?
- SpreadsheetApp (Correct answer)
- DocumentApp
- SheetService
- GoogleSheets
Correct answer: SpreadsheetApp
SpreadsheetApp is the entry-point service for interacting with Google Sheets.
Question 3: Which method returns the currently active sheet within a spreadsheet?
- getActiveSheet() (Correct answer)
- getCurrentTab()
- openSheet()
- selectSheet()
Correct answer: getActiveSheet()
getActiveSheet() returns the sheet a user is currently viewing.
Question 4: A macro that must run automatically whenever the sheet is opened should be implemented as:
- An onOpen() trigger function (Correct answer)
- A recorded macro with a shortcut
- A named range
- A conditional format rule
Correct answer: An onOpen() trigger function
The onOpen() simple trigger runs automatically when the spreadsheet opens.
Question 5: What happens if you record a macro while 'Absolute references' is selected and then run it from a different cell?
- It still affects the originally recorded cell addresses (Correct answer)
- It shifts to the new active cell
- It throws an error
- It affects the entire column
Correct answer: It still affects the originally recorded cell addresses
Absolute references lock the macro to the exact cells recorded, regardless of the active cell.
Question 6: Which statement about macro execution permissions is correct?
- The user may be prompted to authorize the script the first time it runs (Correct answer)
- Macros never require authorization
- Only the file owner can run any macro
- Authorization is granted automatically for all scripts
Correct answer: The user may be prompted to authorize the script the first time it runs
Apps Script prompts for authorization when a macro first accesses your data.
Question 7: To rename a macro, you should:
- Use Extensions > Macros > Manage macros and edit the name (Correct answer)
- Rename the function only in code with no other step
- Delete the spreadsheet
- Use the Rename option on the sheet tab
Correct answer: Use Extensions > Macros > Manage macros and edit the name
The Manage macros dialog lets you rename an existing macro.
A recorded macro is imported into another spreadsheet by: