Curl request in the documentation:
curl -X POST -d "xls_url=https://kc.kobotoolbox.org/ukanga/forms/tutorial/form.xls" https://kc.kobotoolbox.org/api/v1/forms
My apps script
function patchForm() {
//Other details saved in scriptProperties
var payload = "https://docs.google.com/spreadsheets/d/e/.../pub?
output=xlsx";
//Published spreadsheet, I think this is essentially an xlsx file stored in a url?
var scriptProperties = PropertiesService.getScriptProperties();
var url = "https://kc.kobotoolbox.org/api/v1/forms/...";
var params = {
"method" : scriptProperties.getProperties()["method"],
"headers": {"Authorization" : scriptProperties.getProperties()["Authorization"]},
"xls_url": payload
};
Logger.log(params)
UrlFetchApp.fetch(url, headers = params)
return(UrlFetchApp.fetch(url, headers = params));
}
How do I convert the:
"xls_url=https://kc.kobotoolbox.org/ukanga/forms/tutorial/form.xls"
In the api documentation inside urlfetchapp.
Thank you, not really a programmer.
If I cant get urlfetchapp to work, is there a way to send a curl request via google script?