Complete the code to get the active spreadsheet in Apps Script.
var sheet = SpreadsheetApp.[1]();The method getActiveSpreadsheet() returns the spreadsheet the script is bound to or currently active.
Complete the code to get the value of cell A1 in the active sheet.
var value = sheet.getRange('[1]').getValue();
The cell A1 is the top-left cell in the sheet, so to get its value, use getRange('A1').
Fix the error in the code to set the value 'Hello' in cell B2.
sheet.getRange('B2').[1]('Hello');
To set a single cell's value, use setValue(). The others are for getting values or setting multiple cells.
Fill both blanks to create a function that logs the value of cell C3.
function logCell() {
var sheet = SpreadsheetApp.[1]();
var value = sheet.getRange('[2]').getValue();
Logger.log(value);
}The function gets the active sheet and then reads the value from cell C3 to log it.
Fill all three blanks to create a function that sets 'Done' in cell D4 of the active sheet.
function markDone() {
var sheet = SpreadsheetApp.[1]();
var range = sheet.getRange('[2]');
range.[3]('Done');
}The function gets the active sheet, selects cell D4, and sets its value to 'Done'.