function auto_data() {
var formURL="https://docs.google.com/forms/d/e/1FAIpQLSfB4NZHDqagGZDSyAmn0prmCThgRgp44ED7TsQDbrdvPCL9-A/viewform?usp=sf_link";
var wrkBk = SpreadsheetApp.getActiveSpreadsheet();
var wrkSht = wrkBk.getSheetByName("Sheet1");
var stunumber = wrkSht.getRange("A2").getValue();
var firstn = wrkSht.getRange("B2").getValue();
var lastn = wrkSht.getRange("C2").getValue();
var cohort = wrkSht.getRange("D2").getValue();
var teacher = wrkSht.getRange("E2").getValue();
var datamap = {"entry.1349037061":stunumber,
"entry.115259800":firstn,
"entry.1390558599":lastn,
"entry.245609341":cohort,
"entry.1444620207":teacher};
var options = {
"method": "post",
"payload" : datamap
};
UrlFetchApp.fetch (formURL,options);
}
------------------------------------------------------------------------
when executing the script, I receive this error message:
Exception: Request failed for https://docs.google.com returned code 405. Truncated server response: <!DOCTYPE html>
Does anyone know how to solve this error? it was working fine last night :(
Hi @methuna thayalan ,
welcome to the Atlassian Community!
Error 405 means "Method Not Allowed" - it is not possible to send POST request to the url provided in the script.
I think you are not using correct url. According to the article, it should probably look like this:
But please be aware I didn't test it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.