Adding interactive images with Apps Script connections via Sheets API

I know that in Google Sheets you can manually add an image to a cell and make it clickable so it runs a custom function in Apps Script. This works great when doing it by hand in the interface. But I’m wondering if there’s a way to do this programmatically from my backend server. Can I use the Google Sheets API to insert these interactive images that trigger Apps Script functions? Or maybe there’s another approach where I can directly call Apps Script functions from my server instead? I’m building an application that needs to create spreadsheets with interactive elements automatically, so doing this manually isn’t really an option. Has anyone found a way to make this work through the API?

The Sheets API won’t handle interactive images - I ran into this same wall. What worked for me was flipping the approach entirely. Instead of fighting the Sheets API, I made Apps Script the main driver and used the Execution API to call it from my backend. I wrote Apps Script functions that create the spreadsheet content and add interactive images all at once. This way you’re working inside Apps Script where interactive features actually work properly, rather than trying to hack around the Sheets API’s limitations.

totally get u! the sheets api is a pain for interactivity. i’ve had success using drawing objs too. set an onEdit trigger to detect clicks on those cells. it’s a workaround for sure but better than nothing for automation.

I encountered a similar challenge while working on a client project. The Google Sheets API does not support adding interactive images that can trigger Apps Script functions directly. My solution involved using the Sheets API to insert standard images first, then implementing an Apps Script function that iterates through these images and converts them into interactive versions using the SpreadsheetApp methods. This conversion function can be triggered from your backend through the Apps Script Execution API. While it isn’t a perfect solution, it significantly streamlines the process and eliminates the need for manual intervention.