I’m trying to set up a connection between my MySQL database and Google Sheets using Google Apps Script. The problem is that my database server has a firewall configured with IP whitelisting for security reasons. I need to know what IP addresses Google Apps Script uses so I can add them to my whitelist. Has anyone dealt with this before? Are there specific IP ranges that Google Apps Script requests come from? I’m also open to hearing about alternative approaches if whitelisting isn’t practical. Any suggestions would be really helpful!
Had this exact issue 6 months ago with a data sync project. Google Apps Script IPs are all over the place - they rotate constantly, so whitelisting is a nightmare. Here’s what actually worked: I set up a simple API gateway with Google Cloud Run. Built a lightweight service that handles DB connections and auth, then locked it down to only accept requests from my Apps Script project using API keys. Took maybe 2 hours to set up, but no more IP headaches. Bonus - DB performance got better too since connection pooling happens at the gateway instead of creating new connections every time the script runs.
totally feel ya on this! it’s such a pain trying to keep up w/ the changing IPs for Google Apps Script. a webhook service or a custom API is def the way to go! it not only keeps it secure but also makes troubleshooting way easier. good luck!
Google Apps Script doesn’t provide fixed IP addresses to whitelist, which complicates things for database connections. The IPs are subject to change frequently due to the nature of Google’s infrastructure. I encountered a similar issue while connecting GAS to a client’s MySQL setup. Instead of attempting to manage IP whitelisting, I opted for Google Cloud Functions as a middleware proxy. This method establishes a secure HTTPS endpoint for your Apps Script, allowing for better authentication control without the hassle of constantly adjusting firewall settings. Alternatively, setting up a VPN could work if your hosting provider allows it, but it’s a more intricate solution.