Need advice: Syncing RPG data to spreadsheet in real-time

Hey folks! I’m working on a text RPG that runs in ChatGPT. The game spits out JSON-style commands for stuff like XP, items, and quests. I want to automatically update a Google Sheet with this info as I play.

I’ve set up a Google Apps Script that works when I manually send data. But I’m stuck on the auto-updating part. I tried a few things:

  1. A Tampermonkey script to catch commands in ChatGPT, but it’s not working right.
  2. A bookmarklet to send data, but nothing happens.
  3. Selenium to observe ChatGPT, but it keeps crashing.

I’m looking for a way to:

  • Spot when ChatGPT produces a command
  • Send that information to my Google Sheet
  • Do all this while I continue playing

Any ideas or better approaches to solve this issue? I’d really appreciate your help so I can focus on developing the game. Thanks!

As someone who’s worked on similar projects, I’d suggest looking into using a browser extension for this. I’ve had success with creating a custom Chrome extension that can listen for specific DOM changes in ChatGPT’s output. The extension monitors the ChatGPT page for new responses and, when it detects a JSON-style command, it parses and extracts the relevant data before sending this directly to your Google Apps Script web app. This approach is less invasive than Tampermonkey and more reliable than Selenium, keeping everything contained within the browser. Note that you’ll need to have a good grasp of JavaScript to build and customize the extension, but once in place, it should operate seamlessly in the background while you play.

have u tried using a webhook setup? u could configure chatgpt to send commands to a webhook endpoint, which then triggers ur google apps script. this way, the data flows automatically without needing browser scripts or selenium. might be worth a shot if u haven’t explored it yet!

Consider leveraging a middleware solution like Zapier or IFTTT. These platforms can act as intermediaries, monitoring your ChatGPT output and triggering updates to your Google Sheet. You’d need to set up a webhook or API endpoint for ChatGPT to send data to, which then gets routed through the middleware to update your spreadsheet. This approach eliminates the need for browser-based scripts or local automation tools, making it more reliable and easier to maintain. It might require a bit more initial setup, but should provide a more robust, cloud-based solution for your real-time syncing needs.