I am trying to create an application where I want to update in a excel sheet. I came across with https://github.com/dwyl/html-form-send-email-via-google-script-without-server which apparently not working with angular. Replacing the 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 as "Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' ". Is there a way to fix it? Or may be an another way to add data to excel sheet using angular 2?