function doGet(e){
var p = e.parameters;
try {
if ("username" in p) { // user info get
let id = p.ID;
let username = p.username;
let time = p.time;
let email = p.email;
let roles = p.roles;
let value = [id,username,time,email,roles];
userSheet.appendRow(value);
userSheet.getRange("F38").setValue(username) // This executes correctly;
return ContentService.createTextOutput(username);
}
} catch (e){
return ContentService.createTextOutput("Error: " + e.message);
}
}
I am sending wordpress user data to my google app script API so it can be stored in the sheet.
If I execute appendRow()
like
function test(){
let id =23;
let idd = "23";
userSheet.appendRow([id,idd]);
}
The data is correctly inserted.
Also if I insert the data from GET by setValue
userSheet.getRange("F38").setValue(username) // This executes correctly;
there is no problem either.
So what is wrong with my code?
P.S. This question is related: Google Apps Script as Web App: problems with doPost(). Originally I intended to POST user data to my API, however, I can't solve the problem described in this question, so I have to use GET.