Reputation:
Is it possible to use a var (in A1 notation) inside a getRange?
function reservar() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var form = ss.getSheetByName("Respuestas de formulario 1");
var ss_calendario = SpreadsheetApp.openById('1r0jLPIfOAmOD7Lim9qmscQsrx5GAworz6ug1O-XAHDg');
var calendario = ss_calendario.getSheetByName("Disponibilidad");
var rango = form.getRange(1,1,form.getLastRow(),16);
var data = rango.getValues()
for (var i = 0; i < data.length; ++i) {
var columna = data[i];
var disponible = columna[9];
var celda = columna[14];
if(disponible == "Disponible"){
calendario.getRange(celda).setValue(true);
}
}
}
In the last line of code im trying to set to true the calendars day of the A1 notation value of the var celda
but i keep getting the no interval found message.
[18-05-27 14:06:54:406 ART] Sheet.getRange(["Celda"]) [0,108 segundos]
[18-05-27 14:06:54:455 ART] Ejecución fallida: No se ha encontrado el intervalo. (línea 16, archivo "Código") [0,478 segundos de tiempo de ejecución total]
I assume it's being passed ["Celda"]
, isn't that the type of value im looking for? i.e "B71"
Upvotes: 0
Views: 277
Reputation: 38254
It looks that the value that you are getting is the column header on your sheet, specially because your loop starts on 0.
Change
for (var i = 0; i < data.length; ++i) {
to
for (var i = 1; i < data.length; ++i) {
Upvotes: 1