Challenge - 5 Problems
Spreadsheet Mastery: Creating and Opening
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📊 Formula Result
intermediate2:00remaining
Opening a spreadsheet by URL
You want to open a Google Sheets spreadsheet using its URL in Apps Script. Which line of code correctly opens the spreadsheet?
Attempts:
2 left
💡 Hint
Remember the method name includes 'ByUrl' when opening by URL.
✗ Incorrect
The correct method to open a spreadsheet by its URL is SpreadsheetApp.openByUrl(url). Other methods either don't exist or require different parameters.
❓ Function Choice
intermediate2:00remaining
Creating a new spreadsheet with a name
Which function creates a new Google Sheets spreadsheet with the name 'Budget 2024'?
Attempts:
2 left
💡 Hint
The method to create a new spreadsheet is named 'create'.
✗ Incorrect
SpreadsheetApp.create(name) creates a new spreadsheet with the given name. Other options are invalid methods.
🎯 Scenario
advanced2:30remaining
Accessing a spreadsheet by ID and getting its name
You have the spreadsheet ID '1a2b3c4d5e'. Which code snippet correctly opens the spreadsheet and gets its name?
Attempts:
2 left
💡 Hint
Use the method that opens by ID and the method that returns the spreadsheet's name.
✗ Incorrect
SpreadsheetApp.openById(id) opens the spreadsheet by its ID. The method getName() returns the spreadsheet's name. Other methods are invalid or incorrect.
📊 Formula Result
advanced2:00remaining
Result of creating and accessing a new spreadsheet
What is the output of this Apps Script code snippet?
var ss = SpreadsheetApp.create('Test Sheet');
var name = ss.getName();
Logger.log(name);
Google Sheets
var ss = SpreadsheetApp.create('Test Sheet');
var name = ss.getName();
Logger.log(name);Attempts:
2 left
💡 Hint
The getName() method returns the name of the spreadsheet.
✗ Incorrect
The code creates a new spreadsheet named 'Test Sheet' and then gets its name, which is 'Test Sheet'.
❓ data_analysis
expert2:00remaining
Identifying error when opening spreadsheet by URL with wrong method
What error will this Apps Script code produce?
var ss = SpreadsheetApp.open('https://docs.google.com/spreadsheets/d/abc123');
Google Sheets
var ss = SpreadsheetApp.open('https://docs.google.com/spreadsheets/d/abc123');
Attempts:
2 left
💡 Hint
Check if the method 'open' exists in SpreadsheetApp.
✗ Incorrect
SpreadsheetApp does not have an 'open' method. The correct method to open by URL is 'openByUrl'. Using 'open' causes a TypeError.