Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to get the email address from cell A2.
Google Sheets
var email = sheet.getRange([1]).getValue(); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong cell address like B2 or A1.
Not putting quotes around the cell address.
✗ Incorrect
The email address is in cell A2, so we use "A2" to get its value.
2fill in blank
mediumComplete the code to send an email with subject "Hello".
Google Sheets
MailApp.sendEmail([1], "Hello", "This is a test email.");
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the subject or message variable instead of the email address.
Using a wrong variable name.
✗ Incorrect
The first argument of sendEmail is the recipient's email address, stored in the variable email.
3fill in blank
hardFix the error in this code to get the message from cell B2.
Google Sheets
var message = sheet.getRange([1]).getValue(); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Writing B2 without quotes causes an error.
Swapping the column and row like 2B is invalid.
✗ Incorrect
Cell addresses must be strings with quotes, so use "B2".
4fill in blank
hardFill both blanks to create a dictionary with email as key and message as value.
Google Sheets
var data = { [1]: [2] }; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around variable names makes them strings, not variables.
Swapping key and value positions.
✗ Incorrect
Use the variable email as key and message as value without quotes.
5fill in blank
hardFill all three blanks to send an email with subject and message from the sheet.
Google Sheets
MailApp.sendEmail([1], [2], [3]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variables without quotes for the subject.
Swapping the order of arguments.
✗ Incorrect
The first argument is the recipient email, second is the subject string, third is the message variable.