Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

606
Vistas
Fetching json data from google apps script webapp

is there a way to get data from a google apps script webapp page without running into cors issues? I run into this when I make a get request from my app (currently running on localhost) to my appscript page. I am trying to get a list of folder names and urls. Please if anyone has an answer it will be much appreciated. Been trying to get past this nightmare for days now. See the error message below and my appscript's code

function getData() {
  var folders = DriveApp.getFolders();
  var foldersArray = [];
  while (folders.hasNext()) {
  var folder = folders.next();
  foldersArray.push([folder.getName(),folder.getUrl()])
  Logger.log(foldersArray)
}
var   json = Object.assign(...foldersArray.map(([k, v]) => ({ [k]: v })));
  console.log(json);

  return json;
}


function doGet(e){   
  var content = getData();
 return ContentService
    .createTextOutput(JSON.stringify(content))
    .setMimeType(ContentService.MimeType.JAVASCRIPT);
}

"Access to fetch at 'https://script.google.com/macros/s/AKfycbwU2jEQda0VRtIstNMcfyyGEO-aHgxRqHOdbZWwJIDcVQj7h2cTMyNUrqejuJQKBvHf_w/exec' from origin 'https://docs.google.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I ran into a similar problem. The only way I found to solve it was to make the call to the script app from the server side, which probably means you'll just have to implement an ajax call from your client and let your server-side code proxy the request.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda