r/GoogleAppsScript • u/gsan300 • Jun 11 '25
Question "Simple" Script Stumping all LLMs - What's The Best Solution?
Hello-
I've had success with Claude/ChatGPT writing decent app script code, but the below use case has stumped Claude, ChatGPT, Gemini, Cursor, Windsurf, etc.
I have a google sheet with ~700 rows, each with a company's name and a URL. The list is dated, so some of those companies may no longer be in business. Quite simply, I want the script to look at each URL, write to a column if the web site is still alive or not, and if it is alive write a brief description of what the company does.
I can get a script to do this for one line, no problem. But anything more than that, the script either throws errors or stalls.
Each of those tools has written lines and lines of code, but it never works, even after back and forth of debugging.
Key Questions
- What is the best LLM to use for App Script code generation?
- Is what I'm asking the code to do just beyond the capabilities of Google Sheets?
15
u/FVMF1984 Jun 11 '25
If you have working code for one line, you should not need a LLM to generate the script for you. If you share the working code for one line here, someone can easily give you a version which loops over all the rows.
12
u/Uncrowned_Emperor Jun 11 '25
Just maybe, learn some JS?
3
u/Alynva Jun 11 '25
I don't get it what problem are you having. I literally just sent your paragraph explaining the problem and it gave me a reasonable script for doing it. It even tries to identify the page's title and description
2
u/Vegetable-Two-4644 Jun 11 '25
You said it stalls? Could it be running into the issue where if a script takes too long it times out? I think the timer is around six minutes?
1
u/WicketTheQuerent Jun 11 '25
1
u/Canecraze Jun 12 '25
Try perplexity. It's a game changer.
1
u/HellDuke Jun 11 '25
Well to start with using an LLM to write code is generally not a good idea. An LLM will work fine if the code you are writing is either in it's entirety or in very large chunks already discussed to no end (i.e. the LLM is writing something many people wrote already and discuss regularly), but it will crumble the moment you try to do something that might be a bit unique or somewhat edge case.
In your scenario, there are 2 likely reasons. One is that you hit a 6 minute time or the http request limit. The other is that your request somehow errors you out.
For the first you can try to get around the time limit by monitoring how long it has been running and terminate it ahead of time while storing the row you last completed. Part of the termination would create a trigger to start again in a minute where you left off. I doubt you are hitting the limit with requests as you get 20k of them even on personal account, but if you do make 20k requests per day, same idea as before you just get the trigger to resume in 24 hours.
Fetchapp should mute errors by default, but an llm might use the flag that would throw an exception when the request fails or there is no handling for when a request fails