I have refer to youtube about how to read all and delete data in google sheet using the script code but when I press the button ReadAll, it show error message: Cannot parse text argument to "list from csv table" as a CSV-formatted table. Hope anyone could help me with this.
Tidy up your script, use this: [note openByID changed to openById]
function doGet(e) {
var ss = SpreadsheetApp.openById('1ywhNjaM3d84PvQGgg_WIxDNsxavzaqw2F36B6Ur6pwI');
var sh = ss.getSheetByName('Failure');
var message = '';
//READ ALL RECORDS
if ( e.parameter.func == "ReadAll") {
var rg = sh.getDataRange().getValues();
var outString = '';
for(var row=0 ; row<rg.length ; ++row){
outString += rg[row].join(',') + '\n';
}
message = outstring;
}
//DELETE SINGLE RECORD
else if (e.parameter.func == "Delete") {
var record = e.parameter.id;
sh.deleteRow(parseInt(record) + 1);
message = 'Row Deleted';
}
return ContentService.createTextOutput(message);
}
Thanks for the help, but when I try to run and debug the script, it shows error : TypeError: SpreadsheetApp.openByID is not a function (line 2, file "Code").
I have try to change the block to execute the global url but the error still the same which is : Cannot parse text argument to "list from csv table" as a CSV-formatted table.
Try setting the variables ss and sh either outside the doGet(e) function, at the top of the script, or at the very least before you call the ManageSheet(e) return. If you use the doPost(e) function, then you need to ensure that these variables are set.
Do not forget to re-deploy your script to a new version
Not sure what you mean by this? You appear to have your script deployed correctly because you have a script url. Have you allowed the script to run as "Anyone" ?
No, because you have hardcoded the spreadsheet ID and the sheetName in the script
If you use this url:
You do not need to use the script (if your spreadsheet has access for anyone permissions). This will return the data in csv format, which you can convert to an AI2 list in the Web1.GotText.
This looks wrong
Because you are using doGet(e) to get data, you should be able to test your urls in your computer browser, which will either display results or download a csv file to your computer
Ran a quick test on your data, and it works OK, although it looks like there is some work to do on date formats. Obviously requires your layout/textboxes etc. to fit the data.