This is surely a newbie question but I am breaking my head over it. I just don't understand what I'm doing wrong! I have the following script which is incomplete and definitely incorrect. But my issue is that when I run it, I get the following error:
TypeError: SpreadsheetApp.getSpreadsheetById is not a function
This is the script:
function matchRow() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var ts = SpreadsheetApp.getSpreadsheetById('1Sq5prZI4a_UwesPTUQLnmXvtpJClyMcMlHM-m3JrE6g').getSheetByName('Quiz advertiser');
var countryIndex = ('Spain', 'Germany', 'France');
var getLastRowByMatch = matchRow();
if (ss.countryIndex = 'Spain');
getss.LastRowByMatch;
}
What am I doing wrong?
CodePudding user response:
SpreadsheetApp.getSpreadsheetById
doesn't exist. Instead of
var ts = SpreadsheetApp.getSpreadsheetById('1Sq5prZI4a_UwesPTUQLnmXvtpJClyMcMlHM-m3JrE6g').getSheetByName('Quiz advertiser');
use
var ts = SpreadsheetApp.openById('1Sq5prZI4a_UwesPTUQLnmXvtpJClyMcMlHM-m3JrE6g').getSheetByName('Quiz advertiser');
By the way, the lines after the referred one doesn't make any sense. It looks that you have to spend some time reviewing https://developers.google.com/apps-script/guides/sheets.
References