# Component trigger in App to send entire Google Sheet via email

**URL:** <https://community.glideapps.com/t/component-trigger-in-app-to-send-entire-google-sheet-via-email/2431>\
**Category:** Ask for Help\
**Created:** [November 26, 2019, 9:15pm UTC](https://community.glideapps.com/t/component-trigger-in-app-to-send-entire-google-sheet-via-email/2431 "2019-11-26T21:15:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cinehaus](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/cinehaus/32/1863_2.png) [@Cinehaus](https://community.glideapps.com/u/Cinehaus)\
**Post date:** [November 26, 2019, 9:15pm UTC](https://community.glideapps.com/t/component-trigger-in-app-to-send-entire-google-sheet-via-email/2431/1 "2019-11-26T21:15:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sidney\_Kunst](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sidney_kunst/32/603_2.png) [@Sidney\_Kunst](https://community.glideapps.com/u/Sidney_Kunst)\
**Post date:** [November 26, 2019, 9:28pm UTC](https://community.glideapps.com/t/component-trigger-in-app-to-send-entire-google-sheet-via-email/2431/2 "2019-11-26T21:28:48Z")

</div>

Microsoft flow can do this for you!

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [November 27, 2019, 12:02am UTC](https://community.glideapps.com/t/component-trigger-in-app-to-send-entire-google-sheet-via-email/2431/3 "2019-11-27T00:02:59Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/0/04f89850d92a95a26ee0b515f111a98f9cfbb218.png)

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.

> [@Filter Tabs/Menu by signed-in user](https://community.glideapps.com/t/filter-tabs-menu-by-signed-in-user/992/9):
>
> Hey Jeff, I’m probably using the same method you are ([https://docs.google.com/spreadsheets/d/](https://docs.google.com/spreadsheets/d/){SPREADSHEET ID}/export?gid={SHEET ID}&exportFormat=pdf&format=pdf&portrait=true&single=true&size=0&fitw=false, or some variation of that), which works beautifully on the computer and iOS. But for some quirky reason it doesn’t work on Android, unless the user has a PDF app installed. If you don’t need it formatted in portrait mode, you can try adding "[https://docs.google.com/viewer?url=](https://docs.google.com/viewer?url=)"before the PDF e…

This is another thread that talks about using scripting.

> [@Email Report](https://community.glideapps.com/t/email-report/1452):
>
> If I set up my app to generate a report how can I get it to send said report it the layout it’s set up in the app as an email or a Pdf document

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [November 27, 2019, 12:07am UTC](https://community.glideapps.com/t/component-trigger-in-app-to-send-entire-google-sheet-via-email/2431/4 "2019-11-27T00:07:29Z")

</div>

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.

> [@Backup My Data In My Spreadsheet](https://community.glideapps.com/t/backup-my-data-in-my-spreadsheet/1147/2):
>
> First of all, google does keep a history of any changes. You can access them by clicking the link at the top of the sheet: I also use this script to backup my sheet every week. The only thing that needs to change in the script is the destination folder. This gives me a weekly backup with a timestamp attached to the name: // Abhijeet Chopra // 26 February 2016 // Google Apps Script to make copies of Google Sheet in specified destination folder function makeCopy() { // generates…

---

<div class="post-metadata">

**Author:** ![Cinehaus](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/cinehaus/32/1863_2.png) [@Cinehaus](https://community.glideapps.com/u/Cinehaus)\
**Post date:** [November 28, 2019, 5:56pm UTC](https://community.glideapps.com/t/component-trigger-in-app-to-send-entire-google-sheet-via-email/2431/5 "2019-11-28T17:56:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Julien](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/julien/32/1003_2.png) [@Julien](https://community.glideapps.com/u/Julien)\
**Post date:** [November 29, 2019, 5:23am UTC](https://community.glideapps.com/t/component-trigger-in-app-to-send-entire-google-sheet-via-email/2431/6 "2019-11-29T05:23:26Z")

</div>

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.
