I am trying to create an application that I want to update on an excel worksheet. I came across https://github.com/dwyl/html-form-send-email-via-google-script-without-server , which apparently does not work with angular. Replacing ajax call with
onsubmitForm() {
let headers = new Headers();
headers.append('Access-Control-Allow-Origin','*');
let options = new RequestOptions({ headers: headers });
let body = {
name:"lala",
message:"ssss",
email:"a@k.com",
color:"red"
}
return this.http.put('https://script.google.com/macros/s/AKfycbxJKxvzl8Go5ZihUc95su-HFvFeoTtnMyA3qq5YiBxcDYalDdOb/exec', body).toPromise(); }
I got an error: “The response to the pre-flight check request does not pass the access control check: No“ Access-Control-Allow-Origin. ”Is there a way to fix this? Or could there be another way to add data to the Excel sheet using angular 2?
source
share