what do you meen by : Is your web app script bound to the spreadsheet ?
in do not know how to bound my app scirpt to the spreadsheet
what do you meen by : Is your web app script bound to the spreadsheet ?
in do not know how to bound my app scirpt to the spreadsheet
do you konw why : return ContentService.createTextOutput("Success");
do not retun "success"
See here:
This is probably because you are using Spreadsheet.getActive() in a standalone script ?
great scripte works now the problem was because my script was not bound
it is bound finally
but "return ContentService.createTextOutput(“Success”);" still does not work even if this time script is bound....
any idea?
Diifficult to say. Would need “full” access to your spradsheet, script, blocks (aia) and script to understand what is going wrong and test
i found the probleme it is the diference between post and get
return ContentService.createTextOutput("Success");
work whith get but not whith post
OK, well done
You can use both, just have a doGet and a do Post in your script:
doGet() {
<code>;
return ContentService.createTextOutput("Success");
}
doPost() {
<code>;
return ContentService.createTextOutput("Success");
}
The only difference is that you don’t use the “?” before the first parameter for doPost in the posttext block
Merci beaucoup pour votre aide je progresse enfin ( a tout petit pas mais grâce a vous)
Encore 2 petits problèmes.
Add —> efface les numéros automatique
Read --> ne retourne rien???
function doGet(e) {
var ss = SpreadsheetApp.getActive();
//var sheet = ss.getSheetByName(“Names”);
var sheet = ss.getSheets()[0];
//lock sheet to prevent concurrent changes
var lock = LockService.getPublicLock();
lock.waitLock(5000);
//
if (e.parameter.Action==“Read”) {
var data = sheet.getDataRange().getValues();
var outString=’’;
for (var row=0;row<data.lenght;row++){
outString+=data[row].join(',')+'\n';
}
return ContentService.createTextOutput(outString).setMimeType(ContentService.MimeType.TEXT);
}
// Add
else if (e.parameter.Action==“Add”) {
var values = [["",e.parameter.name,e.parameter.age]];
sheet.appendRow(values);
return ContentService.createTextOutput("Add OK");
}
// edit one element
else if (e.parameter.Action==“Edit”) {
var data = sheet.getDataRange().getValues();
var row = “”;
for (var i=0;i<data.length;i++) {
if ( data[i][0] == e.parameter.numRowToEdit ) {
row = i;
}
}
var values = [["",e.parameter.name,e.parameter.age]];
var range = sheet.getRange(“A” + [row+1] + “:C” +[row+1]);
range.setValues(values);
return ContentService.createTextOutput(“Edit OK”);
}
//delete on rows
else if (e.parameter.Action==“Delete”) {
var NumRowToDelete=e.parameter.NumRowToDelete;
sheet.deleteRow(NumRowToDelete);
return ContentService.createTextOutput("Delete OK");
}
lock.releaseLock();
}
GoogleSheet.aia (4.4 KB)
READ:
You have a spelling mistake in your code:
for (var row=0;row<data.**lenght**;row++){
change to
for (var row=0;row<data.length;row++){
For ADD
Please explain what you mean ? If using the automatic index/numbering on the sheet, then you do not need to send an index number in the doGet/doPost, the data should be appended to the bottom of the sheet and a new index will appear. You would need to call back the data to get the new index (or hopefully know this if your data on the app is already aligned with the data on the sheet…
Before adding a new data
After addind a new data
i do have a ref! error no more numbers and my ligne never add
the only code is
var ss = SpreadsheetApp.getActive();
//var sheet = ss.getSheetByName(“Names”);
var sheet = ss.getSheets()[0];
var values = [["",e.parameter.name,e.parameter.age]];
sheet.appendRow(values);
Sorry for the last speling erro i whould have seen it.
You have empty rows in your spreadsheet. Look down at the bottom row 1001 see what you have there. As I suggested remove all empty rows. Not sure why else this is happening, “” should just do nothing in a cell?
ok you where true lol i had some thing some where…
is it possible to add more than 1000 row?
No, you need to remove all the empty rows, then the appendRow will go in the right place
See like this:
A simple test works for me:
SCRIPT:
function doGet(e) {
var ss = SpreadsheetApp.getActive();
var sh = ss.getSheetByName("Sheet1");
sh.appendRow(["",e.parameter.name,e.parameter.age]);
return ContentService.createTextOutput("Success");
}
url to send via browser or blocks:
https://script.google.com/macros/s/AKfyc...o67f/exec?name=Roger&age=47
Salve a tutti, vi faccio i miei complimenti per aver trovato il modo di collegare Google Sheet, volevo chiedervi un piacere, potete pubblicare l’intero codice script corretto da utilizzare?
grazie mille
ok ti ringrazio mille, ti volevo chiedere delle info.
Io sto cercando di creare un applicazione per il mio piccolo magazzino come questa nel video del lik https://www.youtube.com/watch?v=D8HklSJ5cy4
che modifiche dovrei apportare?
grazie mille ancora della vostra gentilezza.
Either follow the instructions in that video or the info in my links (ct-tricks possibly used much the same code)
hello,
I want to ask a question. First I want to thanks for tutorials and help everybody.
You are a good man.
I created a mini app. İt send data in google spreadsheets. I have a table and But I can not read it. I want to read with vlookup (similar excel). Only specific lines.
thanks
Some methods and ideas for you…