Hello good Morning!!
I'm following this tutorial and I'm in doubt where I put the url of the google spreadsheet I didn't find in the blocks
That is because, as per the title of the howto, the web app is being created "bound" to the spreadsheet, therefore you only need to call SpreadsheetApp.getActive() in the web app
Dear sir,
Your CRUD-GS-AI2 is a fantastic one. Excellent work made by you. I have one doubt in it. Can we use text boxes and labels instead of lvLabel and lvContent (List view). Then how to modify the Update block? Please help sir
Yes, you can use which ever components (that will take the data) to return your spreadsheet data into. You then have to modify your blocks to handle the data and any update methods.
While updating a Google sheet record, Is there any chance to skip a perticular column?. Because I have set an complicated formula on that Google sheet column and so sometimes I have to update through Google sheet also. Perhaps I set formula in app inventor, I am unable to update directly in Google sheet. Because There will be no formula in that column... Any idea sir
function doGet(e) {
return ManageSheet(e);
}
function doPost(e) {
return ManageSheet(e);
}
function ManageSheet(e) {
//READ ALL RECORDS
if ( e.parameter.func == "ReadAll") {
var ss = SpreadsheetApp.openById(e.parameter.ID);
var sh = ss.getSheets()[0];
var rg = sh.getDataRange().getValues();
var outString = '';
for(var row=0 ; row<rg.length ; ++row){
outString += rg[row].join('§') + '\n';
}
return ContentService.createTextOutput(outString).setMimeType(ContentService.MimeType.TEXT);
}
//DELETE SINGLE RECORD
else if (e.parameter.func == "Delete") {
var record = e.parameter.name;
var ss = SpreadsheetApp.openById(e.parameter.ID);
var sh = ss.getSheets()[0];
sh.deleteRow(parseInt(record) + 1);
return ContentService.createTextOutput("Success");
}
//READ SINGLE RECORD
else if ( e.parameter.func == "ReadRecord") {
var ss = SpreadsheetApp.openById(e.parameter.ID);
var sh = ss.getSheets()[0];
var rg = sh.getDataRange().getValues();
var outString = '';
outString += rg[parseInt(e.parameter.id)].join('§');
return ContentService.createTextOutput(outString).setMimeType(ContentService.MimeType.TEXT);
}
//UPDATE SINGLE RECORD
else if (e.parameter.func == "Update") {
var ss = SpreadsheetApp.openById(e.parameter.ID);
var sh = ss.getSheets()[0];
var data = [ [ e.parameter.name, e.parameter.phone ] ];
sh.getRange("B"+(parseInt(e.parameter.id)+1)+":C"+(parseInt(e.parameter.id)+1)).setValues(data);
return ContentService.createTextOutput("Success");
}
}
Is like you say before.
In script i've to change
var ss = SpreadsheetApp.getActive();
to
var ss = SpreadsheetApp.openById(e.parameter.ID);