function doGet() { const datos = obtenerVentasLocales(); // Devolvemos un JSON estructurado con los encabezados correctos para permitir CORS return ContentService.createTextOutput(JSON.stringify(datos)) .setMimeType(ContentService.MimeType.JSON); } function obtenerVentasLocales() { const locales = [ { id: 'CC', url: 'http://net.fh.cl:88/reporte_ventas.asp' }, { id: 'CN', url: 'http://net.fh.cl:85/reporte_ventas.asp' }, { id: 'RE', url: 'http://net.fh.cl:92/reporte_ventas.asp' }, { id: 'MT', url: 'http://net.fh.cl:82/reporte_ventas.asp' }, { id: 'LL', url: 'http://net.fh.cl:81/reporte_ventas.asp' }, { id: 'QT', url: 'http://net.fh.cl:84/reporte_ventas.asp' }, { id: 'PU', url: 'http://net.fh.cl:83/reporte_ventas.asp' } ]; let resultados = []; locales.forEach(local => { try { const response = UrlFetchApp.fetch(local.url, { muteHttpExceptions: true, deadline: 15 }); const html = response.getContentText('ISO-8859-1'); const regex = /