Home > Software design >  How to set CORS headers on google scripts side?
How to set CORS headers on google scripts side?

Time:11-04

Error image

I am trying to give access to my page to send data from my form to google sheets. I use simple form and it only does GET request to google API with some parameters.

After the request is send I get status 200 but with that I also get CORS error

I read that I supposed to give permission on Google Cloud, but could not do that

Does anyone know the solution?

CodePudding user response:

You can't. Consider using ContentService to serve data from Google apps scripts. This can serve text/json/jsonp, some of which are excluded from the CORS protocol.

CodePudding user response:

Figured it out!

Just return ContentService.createTextOutput() in your doGet or doPost

  • Related