I'm writing a script on a Google Sheet that will be interacting with Google Map's Geocoding service.
The following code works correctly.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var header_v = ss.getRange("1:1").getValues();
However, later on in my function, I call Sheet.getRange()
again using the Sheet.getRange(number, number, number, number)
method:
var target_range = ss.getRange(1, ss.getLastColumn()+1, ss.getLastRow(), 10);
throws the following exception:
Exception: The parameters (String,number,number,number) don't match the method signature for Spreadsheet.getRange.
I've tried substituting the first parameter with a variable I know to be a number, to the same effect.
This is the function in its current state.
function geocode() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var header_v = ss.getRange("1:1").getValues();
var col_indxs = {
name : header_v[0].indexOf("restaurant_name"),
address : header_v[0].indexOf("address")
}
var target_range = ss.getRange(1, ss.getLastColumn()+1, ss.getLastRow(), 10);
Logger.log(target_range.getA1Notation());
}
Resolved this myself.
var ss = SpreadsheetApp.getActiveSpreadsheet();
Returns a Spreadsheet
, however the getRange(number, number, number, number)
is a member of the Sheet
class.
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
Solved my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With