Hola tengo el sigueinte error me podrian ayudar
bad arguments to select list item the operation select list cannot accep the arguments DOCTYPE
Something wrong with your google apps script, code or setup or what you are sending it.
Show script, and example values that you are sending to it (for TextBox1.Text and sdata.
var ssId = "1DqcE7DlNzT5fOT65hVH2_ufFpLX-kfScTgtR5nYlEA4";
function doGet(e){
insert(e);
//Para validar datos
var accion = e.parameter.accion;
var columna2 = e.parameter.num;
var valores = e.parameter.valores;
var datos = buscar(accion,columna2,valores);
var respostaJSON = "[" + JSON.stringify(datos) + "]";
return ContentService.createTextOutput(respostaJSON).setMimeType(ContentService.MimeType.JSON);
}
function doPost(e){
//Give your Sheet name here
//var sheet = ss.getSheetByName("Sheet1");
insert(e);
}
function insert(e){
// reciving scanned data from client i.e android app
var sdata = e.parameter.sdata;
var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1DqcE7DlNzT5fOT65hVH2_ufFpLX-kfScTgtR5nYlEA4/edit#gid=0");
var date = new Date();
var curDate = Utilities.formatDate(date, "GMT-5", "dd/MM/yyyy");
var curDateHora = Utilities.formatDate(date, "GMT-5", "dd/MM/yyyy HH:mm:ss");
var sheet = ss.getSheetByName(curDate);
var name = findInColumn(parseInt(sdata));
Logger.log(name);
sheet.appendRow([curDateHora,sdata,name]);
}
function findInColumn(id) {
var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1DqcE7DlNzT5fOT65hVH2_ufFpLX-kfScTgtR5nYlEA4/edit#gid=0");
var sheet = ss.getSheetByName("ListaInscritos");
Logger.log(sheet);
var columnValues = sheet.getRange(1, 1, sheet.getLastRow()-1, 7).getValues();
Logger.log(columnValues);
var ilen=columnValues.length
var row = 0;
while ( row < ilen && columnValues[row][1] != id ) {
row++;
}
if (row == ilen)
return '';
else
return columnValues[row][2] + " " + columnValues[row][3];
}
function buscar(accion,columna2,valores){
var sh = SpreadsheetApp.openById(ssId) ;
Logger.log(sh);
var sheet = sh.getSheets();
Logger.log(sheet);
if(accion=="contar"){
var numpreg = sheet[0].getDataRange().getNumRows()-1;
var resultado = {"accion": "contar", "numpreg" : numpreg};
return resultado;
};
if(accion=="anadir"){
var datos = valores.split(',') ;
sheet[0].appendRow(datos);
return {"accion" : accion,"valores" : datos };
}else{
var datos = sheet[0].getDataRange().getValues();
for(var i in datos){
var row = datos[i];
var num = row[0] ;
if (num == columna2){
var num = row[0] ;
var columna2 = row[1] ;
var columna3 = row[2] ;
var columna4 = row[3] ;
var columna5 = row[4];
var columna6 = row[5]
var columna7 = row[6] ;
if(accion=="consultar"){
var resultado = {"accion": "consultar", "num" : num , "columna2" : columna2, "columna3" : columna3 , "columna4" : columna4 , "columna5" : columna5 , "columna6" : columna6 , "columna7" : columna7 };
};
return resultado;
};
};
};
return {"num" : "" };
}
The response content is not what you are expecting... display it in a label to find out what you get
Taifun
Your error is introduced here:
Que valor tenra que considerar ??
Me podras brindar el feedback?
Mostrando responseContent:
Luego me muestra el error
in the Web.GotText event you are using the same web component to send a post request...
my guess is, that might be the issue to receive that DOCTYPE message as second response content...
to avoid this you could add an if statement like this
if response content contains "DOCTYPE"
then display a nice error message
else do your processing
alternatively use a second web component to send the Post request
Taifun
En los bloques como colocaria esos datos??
you can find the contains block in the text drawer
please try something and if you got stuck, post a screenshot of your updated relevant blocks
Taifun
Your script has completed but it has not returned any values
As previously indicated, an issue with your script. I have seen "this script" 3 or 4 times before on the community, and each time people using it have had problems with it - it is not very transparent.
You may want to try a simpler CRUD script: