0
0
Google Sheetsspreadsheet~10 mins

API calls from Apps Script in Google Sheets - Interactive Code Practice

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

Complete the code to create a new HTTP GET request using UrlFetchApp.

Google Sheets
var response = UrlFetchApp.[1]('https://api.example.com/data');
Drag options to blanks, or click blank then click option'
Arequest
Bget
Cfetch
Dcall
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'get' or 'request' which are not valid methods in UrlFetchApp.
Trying to call a method that does not exist.
2fill in blank
medium

Complete the code to parse the JSON response text into an object.

Google Sheets
var data = JSON.[1](response.getContentText());
Drag options to blanks, or click blank then click option'
Aparse
Bstringify
Cconvert
DtoObject
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'stringify' which converts objects to JSON text.
Using non-existent methods like 'convert' or 'toObject'.
3fill in blank
hard

Fix the error in the code to set the HTTP method to POST in the options object.

Google Sheets
var options = {method: '[1]', contentType: 'application/json'};
Drag options to blanks, or click blank then click option'
AGet
BPOST
Cpost
DPut
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'post' which may not work.
Using wrong method names like 'Get' or 'Put'.
4fill in blank
hard

Fill both blanks to create a POST request with JSON payload.

Google Sheets
var options = {method: '[1]', payload: JSON.[2](data)};
Drag options to blanks, or click blank then click option'
APOST
Bparse
Cstringify
DGET
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET method when sending data.
Using JSON.parse instead of stringify for payload.
5fill in blank
hard

Fill all three blanks to extract a value from the JSON response and set it in a sheet cell.

Google Sheets
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('[1]');
sheet.getRange([2], [3]).setValue(data.result);
Drag options to blanks, or click blank then click option'
AData
B1
C2
DResults
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong sheet names.
Using zero or invalid row/column numbers.