Copying a spreadsheet into the body of an email - google-apps-script

I have a spreadsheet that I use for work that I send out on a weekly basis. The spreadsheet itself is pretty simple, but it does contain an updating chart.
I want to set up a script that will send the spreadsheet (with included chart) as part of the body of the email. I've seen several threads no here about emailing spreadsheets as a PDF, but I can't find any about sending the sheet as the body of the email.
Any help would be greatly appreciated!

This is really just a matter of pulling the data you want using the Spreadsheet Service, then inserting it into a message as an HTML table for the Gmail service. The chart can be embedded by getting its contents using the getBlob() method, then inserting it using the inlineImages option.

Related

Create a Apps Script that will send email notification based on a Google Form response or what is entered in the cell in Sheets

I have never used Apps Script but I think I have a need now that this might help with. I am trying to figure out how to get a google form (or the response sheet) to send an email notification depending on the answer to a question (or what is entered in the attached responses sheet in the cell for the question). Depending on the response I need to send an email to different people. Is that possible with Apps Script and could someone give me some pointers? Any help would be appreciated.
I am not a programmer so I was looking for some scripts and Youtube videos that I could possibly edit but so far everything I have tried to edit result in an error.

Google Apps Script to add xlsx hyperlinked in gmail into Spreadsheet

I have a very specific task and I found many similar questions but they are all slightly different.
The script is triggered every day at 10am based of the top answer of this post: Is it possible to automate Google Spreadsheets Scripts (e.g. without an event to trigger them)?
I receive a report every day with lines that I want to add into the existing spreadsheet, so I get the report around 8am and then the attached data is added to the spreadsheet through the script.
The situation is that the email is an automated report from Amazon Display Advertising Analytics (Amazon DSP) and the xlsx file is hyperlined, not attached.
So the script, ideally gets the email list from my gmail account, searches for a specific email and retrieves a result. Gets the hyperlinked excel file and copies the content, except for row 1 which are the headers. Adds the content to an already existing spreadsheet.
In the end, I had the help of a Fiverr professional who scripted the code, so out of respect for him I won't publish his work, so if you are interested in it or if you need it, write me a private message!
In the end, I had the help of a Fiverr professional who scripted the code, so out of respect for him I won't publish his work, so if you are interested in it or if you need it, write me a private message!

sending automatic emails by google script

I am trying to set up an automatic email notification system in google spreadsheet.
I would like to send these emails from a specific sheet, name is "contacts".
How can I set up a script what is using this sheet instead of the first sheet?
Thanks
I use a sheets Add-on called formMule. You can select the sheet from which you want to send your emails. Go to the Add-ons menu, and search for "formMule".
FormMule allows you to select the sheet, send on a condition, send up to 12 different email templates. You can send at a specific time as well.
I use it all the time. Let me know if you have any questions about how to use it.

Email notification in google apps script

https://support.google.com/docs/answer/91588?hl=en
I have a Sheet where the the cells are filled in with data that is pulled via Apps Script, which they get from a website. Sometimes they pull in the exact same data, sometimes not. On the old Sheets version I use to be able to get emails when the data only "changes" to a different value. Now with the new Sheets, I get an email when new data is pasted into the cells, even though its the exact same data......and, I can't set it to look at ranges anymore, only the entire document. Is there an easy way to watch cells for when the data changes, and then email myself?
This looks a lot like what you're trying to do.
For checking whether the value has truly changed after the edit, this gives you all the necessary information about it. Hence, you would know whether the new value is the same one or not. Implementing the "workaround" talked about in the second link, I was able to compare and send an email to myself if the value changed. Initiate an onEdit trigger that goes off for your onEdit function which uses these lines after all the checks in place have passed.
var email = "xyz#whatever.com";
MailApp.sendEmail(email, "TriggerMail", "A change has occurred in the Sheet");
NOTE: This only sends you a "notification" sort of an email but you can even include the changed values in the email easily by just following this tutorial.

Google Form Submit > Attach New Responses to Email and Send

I have a script that turns a submitted form into a PDF and emails it automatically but I can't seem to get my head around if it is possible to implement a function i would like: -
User fills in Google form
Submits form
This creates entirely new spreadsheet based on same headers from the form
Emails thie spreadsheet as an .xlsx attachment automatically to a specific email address
Is this possible? I feel like I am missing a simple way to do this but I am having a moment of noobishness! :-)
1, 2, 3 - all quite possible.
4 - Not as such. There's no support in Google Apps Script for converting a Sheet to Excel format. However you could produce a CSV file which would be understood by Excel or any other spreadsheet program, and email that as an attachment.
Generating a CSV is covered in one of the Apps Script tutorials. See Saving a selected Range to a CSV file from Tutorial: Interacting With Your Docs List.
An example of attaching files from Drive is provided in the documentation for MailApp.sendEmail().