Automating my stock sheet meant a day inside Google auth
So today’s job looked easy: automate my investment research sheet, the Google Sheet I live in to track and analyze the stocks I’m watching. I’d wired it up a while back so I could just ask my AI to refresh it on demand, so I figured this was quick. Half an hour, tops.
Then I asked it to refresh and it hit a wall. A login token I’d set up months ago had quietly expired. I’d built it with OAuth in “testing” mode, which hands you a token that dies after seven days, and mine was long dead.
That kicked off a rabbit hole through Google’s cloud console that ate the whole afternoon. A thirty-minute chore turned into hours of untangling settings.
The weirdest discovery: my personal email is somehow also set up as its own organization. I still have no idea how or when that happened. But it had its own policies quietly blocking me, so I had to find and change rules I didn’t know existed. Meanwhile two browser profiles were signed into different accounts and fighting each other, and I kept hitting walls like “this app is blocked” and “can only be used within its organization.”
What finally fixed it was realizing I’d had the wrong kind of login all along. OAuth is built for a human clicking “allow” to grant an app access, so its tokens are tied to me and expire. For a job that runs every morning with nobody watching, I wanted a service account instead: a robot identity that signs in with a key and never expires. Once I switched, the whole mess collapsed into one clean setup.
Even then, “it ran” wasn’t “it’s correct.” I checked the output and caught real errors, including Google’s own market cap showing at half its true size. Always look at the actual numbers.
Now the sheet refreshes every morning (and any time I ask), and I use it to make real investment decisions and track my portfolio. That part I’ll dig into properly in a future essay.