close
Skip to main content

r/GoogleAppsScript


Tengo problemas con el limite de tiempo de google scripts
Tengo problemas con el limite de tiempo de google scripts
Question

Antes de explicar mi problema quiero aclarar que no soy programador, de hecho soy un fotografo.

Le he pedido a Claude que me ayude a crear un google sheets para administrar mi negocio, me ha dado unas lineas de codigo que debo ejecutar en la extension de google scripts y me ha saltado el error "tiempo maximo de espera", he estado tratando de buscar una solucion pero claude, a pesar de buscar diferentes estrategias y modificar las lineas de codigo, no ha logrado solucionar el problema. Son 428 lineas.

Alguien tiene algun consejo?

(se que no deberia usar IA para este tipo de situaciones pero no se programar ni tampoco tengo dinero para contratar a un programador, asi que me toca resolver con las herramientas que tengo a la mano)

Solución:

Solucioné yendo a Gemini y le subi un documento de texto con el codigo completo junto a los comentarios de WicketTheQuerent, le pedi que los analizara y me ayudara a encontrar el error, lo solucionó en dos o tres iteraciones cambiando la rutina de ejecución y dividiendo todo el proceso en 13 procesos de ejecución (son 13 pestañas en google sheets), me tomó menos de 2 minutos ejecutar los 13 procesos.


Prompt your ideas to life with Figma Make. No more explaining your vision in a doc. Pitch your idea with an AI-prompted proof of concept.
Prompt your ideas to life with Figma Make. No more explaining your vision in a doc. Pitch your idea with an AI-prompted proof of concept.


QuickBooks Online API - AgedReceivablesSummary returning 5020 Permission Denied despite valid OAuth and admin credentials
QuickBooks Online API - AgedReceivablesSummary returning 5020 Permission Denied despite valid OAuth and admin credentials
Question

Hey all,

I'm working on a Google Apps Script that pulls AR data from QuickBooks Online and auto-generates a weekly Google Sheet. Everything is working great except for one endpoint — the AR Aging Summary report keeps returning a 5020 Permission Denied error and I can't figure out why.

The error:

json

{"Fault":{"Error":[{"Message":"Permission Denied Error","Detail":"Permission Denied Error : To access this, sign in again or contact an administrator.","code":"5020","element":"ReportName"}],"type":"ValidationFault"}}

The call:

javascript

var url = 'https://quickbooks.api.intuit.com/v3/company/' + realmId +
  '/reports/AgedReceivablesSummary' +
  '?report_date=' + today +
  '&aging_period=30&num_periods=4&minorversion=40';

var response = UrlFetchApp.fetch(url, {
  headers: {
    'Authorization': 'Bearer ' + service.getAccessToken(),
    'Accept': 'application/json'
  },
  muteHttpExceptions: true
});

What I've already ruled out:

  • OAuth is working fine — CompanyInfo, Invoice queries, CreditMemo queries all return 200

  • Authorizing account is primary admin on the QBO company

  • Plan is QuickBooks Online Plus (should support Reports API)

  • Scope is com.intuit.quickbooks.accounting

  • Tried minorversions 40 and 65, same result

  • Cleared and re-authorized tokens multiple times

  • Added accounting_method=Accrual and Content-Type: application/json header, no change

The element: ReportName in the error makes me think it's rejecting the report name itself, but AgedReceivablesSummary is exactly what's in the Intuit docs.

As a workaround I'm currently querying invoices, credit memos, and payments directly and calculating aging buckets myself, but I'm missing credits from journal entries so the workaround isn't complete.

Anyone dealt with this before? Thanks!