У меня вопрос с этим кодом:
<td><input type="button" value="Valider" name="submit" id="submitButton" onclick="foo()"/></td></div>
function foo(){
vrailastRow = 0;
google.script.run.withSuccessHandler(function(lastRow){
vrailastRow=lastRow-1;
console.log(vrailastRow); // => Display value 8
}).withFailureHandler(function(error){
console.log('error');
}).lastR();
console.log(vrailastRow); // => Display value 0 (value define at start)
}
Первый console.log
печатает значение 8, а второй console.log
печатает 0. Я не прибыл, чтобы использовать vrailastRow из google.script.run
Есть идеи?
Функция .gs:
function lastR() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lastRow = sheet.getLastRow();
return lastRow;
}