5

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?

Subhendu Kundu
  • 2,880
  • 3
  • 14
  • 41
  • this is a CORS issue, check this answer: http://stackoverflow.com/questions/35588699/response-to-preflight-request-doesnt-pass-access-control-check-angularjs – Ahmed Musallam Apr 02 '17 at 19:27
  • Possible duplicate of [Response to preflight request doesn't pass access control check AngularJs](http://stackoverflow.com/questions/35588699/response-to-preflight-request-doesnt-pass-access-control-check-angularjs) – Ahmed Musallam Apr 02 '17 at 19:28
  • @Ahmed Mussallam, Thanks for taking the time. But Angularjs and Angular quite different I suppose. – Subhendu Kundu Apr 23 '17 at 12:03

0 Answers0