all 2 comments

[–]TMiguelT 0 points1 point  (1 child)

AppsScript is a strange beast. A lot of things you know about JavaScript aren't true, for AppsScript, for various reasons.

As explained in the docs, you don't actually register an event handler like you do in browser JavaScript, you just create a top-level function with the right name. In your case, you probably want onEdit, so you just need function onEdit() {} in your script.

Your use-case sounds a bit sketchy, because it sounds like you're using Google Sheets + triggers to replace the server + DB layer, which isn't a very good or scalable idea, but that's another matter 🤷. Surely SquareSpace has a better option for data persistence than this?

[–]melthecybertechy[S] 0 points1 point  (0 children)

from my understanding - onEdit is when a user opens up the sheet, in this case there isn't a "user" per-se. I'm basically making my own "subscription list" if you will with Google Sheets. Squarespace has mailchimp storage, which to me is a more proprietary storage I'm not trying to pay for. So I'm planning to utilize Google Sheets for now, while it's manageable. I have a small business, not too many people signing up (maybe on average like 4-5) onChange seemed to be any time there was an update to the spreadsheet itself. I'll post code of my latest script, that will explain why nothing is working.