0
0
Google Sheetsspreadsheet~10 mins

Why Apps Script automates Google Sheets - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to get the active spreadsheet in Apps Script.

Google Sheets
var sheet = SpreadsheetApp.[1]();
Drag options to blanks, or click blank then click option'
AgetActiveSheet
BopenById
CopenByUrl
DgetActiveSpreadsheet
Attempts:
3 left
💡 Hint
Common Mistakes
Using getActiveSheet() returns a sheet, not the whole spreadsheet.
openById requires a spreadsheet ID parameter.
2fill in blank
medium

Complete the code to get the value of cell A1 in the active sheet.

Google Sheets
var value = sheet.getRange('[1]').getValue();
Drag options to blanks, or click blank then click option'
AB2
BA1
CC3
DD4
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong cell reference like B2 or C3.
Forgetting quotes around the cell reference.
3fill in blank
hard

Fix the error in the code to set the value 'Hello' in cell B2.

Google Sheets
sheet.getRange('B2').[1]('Hello');
Drag options to blanks, or click blank then click option'
AsetValue
BgetValue
CsetValues
DgetValues
Attempts:
3 left
💡 Hint
Common Mistakes
Using getValue() which reads a value instead of setting it.
Using setValues() which expects an array of values.
4fill in blank
hard

Fill both blanks to create a function that logs the value of cell C3.

Google Sheets
function logCell() {
  var sheet = SpreadsheetApp.[1]();
  var value = sheet.getRange('[2]').getValue();
  Logger.log(value);
}
Drag options to blanks, or click blank then click option'
AgetActiveSpreadsheet
BopenById
CC3
DA1
Attempts:
3 left
💡 Hint
Common Mistakes
Using openById without an ID parameter.
Using the wrong cell reference like A1.
5fill in blank
hard

Fill all three blanks to create a function that sets 'Done' in cell D4 of the active sheet.

Google Sheets
function markDone() {
  var sheet = SpreadsheetApp.[1]();
  var range = sheet.getRange('[2]');
  range.[3]('Done');
}
Drag options to blanks, or click blank then click option'
AgetActiveSpreadsheet
BD4
CsetValue
DgetActiveSheet
Attempts:
3 left
💡 Hint
Common Mistakes
Using getActiveSpreadsheet() instead of getActiveSheet().
Using getValue() instead of setValue().