Execute Google Sheets script upon closing

I’m looking for a way to set up a trigger in my Google Sheet that works like onOpen(), but is activated when the sheet is closed instead. I couldn’t locate any built-in options in the Google API documentation, nor have I seen any discussions on this topic. Can someone guide me on how to create such a trigger?

Sadly, there’s no direct way to trigger a script on close in Google Sheets. You might need a workaround, like having an external system (if you have one) update a cell with a script when closing from another source. Google’s ecosystem doesn’t support “onClose” triggers directly tho.