Component trigger in App to send entire Google Sheet via email

This may sound a bit unusual, but I wonder if it would be possible to create a component in Glidapps, for example a button, that when clicked would trigger sending an email to a predefined address, with the entire Google spreadsheet attached. Something like a backup button. Or like an end-of-day-button for an app where data needs to be cleared for a fresh start each day. Perhaps with the help of Zapier? But how? I’m stuck. Help is greatly appreciated.

1 Like

Microsoft flow can do this for you!

The best option I can think of right now is to use the Email Button component. That allows you to specify a recipient, subject, body of message etc. You can set the action in a button to send an email, but for some reason you can’t set the subject, body, etc.

To get a copy of your sheet as a PDF, look at the following thread which shows how to create a link that will do that for you. You can include the link in the email and the link will always create an up-to-date PDF version of the sheet.

This is another thread that talks about using scripting.

If you are looking for more of a backup option, here is a script I use to create weekly backups. The script could be modified to also clear or reset a sheet nightly.

Jeff, thank you so much for pointing me in the right direction and providing really great resources. Scripting works very nicely and does exactly what I had in mind, and much more. I succeeded in running my scripts based on time (once every night), which is really neat, but I have not yet found a simple way to create a trigger to run my script once on demand, by pushing a button from within the Glide App on Mobile. I can create a component, but how would that trigger the script? Google Sheets has a few options in their trigger category, but I cannot find one that works for me (other than time based). Running it on every change is too often, as there is other data in my App, which gets updated frequently.

A workaround to achieve your goal, is to set value in a specific cell like ‘Email to be sent’, then have your existing script check this value, sent the email if needed, then reset the value.
Trigger your script based on time or change, and you should be fine.

Setting the value could be done with a button on a specific page of the glide app.

1 Like