@TIMAI2 I’m sorry, I don’t understand the part of the sort the sheet on the timestamp. There is only one sheet and the latest data, I would like it to be added to the 2nd row and the previous data will all be pushed one row down.
function doPost(e) {
var ss = SpreadsheetApp.openByUrl(<YOUR SHEET ID>);
var sheet = ss.getSheetByName(<YOUR SHEET NAME>);
var ts = e.parameter.Time_Stamped;
var ref = e.parameter.Reference_Number;
//adds new data to last row
sheet.appendRow([ts,ref]);
//sorts sheet data by Column A in descending order - newest timestamp first
sheet.sort({column: 1, ascending: false});
}
If your first row is frozen, this will not be included in the sorting
The fact that you are getting html back indicates a problem with your script. Have you:
1 Open the script project
2 Go to Publish
3 Deploy as Web App
4 Project version: - select New from the dropdown
5 Execute the app as: your google account address (email)
6 Who has access to the app: Anyone, even anonymous
7 Press the Update button
You have to do this EVERY TIME you change your script
Noted about the html response. In my previous reply, I already did the steps that you mentioned. I then created a new app script, with the same code and run. Still the same response.
I then change the code to just append to last row and my response content is still in html, as per image below.
Hence, eventhough it runs as per what I tested (data append to last row), my script still has a problem? If yes, could you assist me in what could be the issue. Thank you.