Forward incoming mail with appscript - google-apps-script

i'm very newbie at this apps scripts...
I'm trying to figure out how to forward an incoming e-mail that matches this 2 conditions:
from: email#example.com
Subject: Some Text here
if it's true, then forward to:
6 different e-mails (i have them under a label in my contacts)
thanks in advance
I have not really tried a script for this, i just searched a lot and there are many scripts but with much more variables and conditions than my needs
i think what i expect is simple, but can't certainly know for sure

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.

Pulling data from Sheets into Gmail template - one email at a time, not a bulk mail merge

I'm trying to come up with a solution that will allow me to (1) pull data from Sheets for only ONE of the rows into a Gmail template and (2) allow for modifying the template with additional information that's not in the spreadsheet before sending it off.
Context: My organization uses an intake/referral log to track key information about referrals. Once info is in the Sheet, they manually send an email assigning the referral to an employee for follow-up. Much of the info in the Sheet is retyped...which initially made me think of automating this fully with AppsScript, so that all the standard info (case #, case type, due dates, etc) is included in that email. However, the emails sometimes have a paragraph or three of contextual information that we don't want to store in the spreadsheets and have pulled into the automated email.
So my goal is to pull the data from the spreadsheet into the email where I can (vs having to retype it) AND allow the addition of contextual info before sending it off to the assigned employee.
Any thoughts on how to accomplish this? I haven't found a mail merge add-on or Apps Script solution that allows doing this one row at a time and adding in extra custom info into the email.
Thanks in advance!
So this question, as currently written, could clearly be accomplished a whole bunch of different ways. With that in mind, here is one quick and dirty way in which it might be accomplished:
On the spreadsheet where the data is stored, create a script via tools>script editor.
Using that script, create a menu which runs a function that does the following, perhaps in an endless loop:
a. Prompt the user for the email address of where to send the email if it isn't in the spreadsheet or a token value, such as an empty string, to end the script.
b. Prompt the user for the number of the row where the info is stored.
c. Prompt the user for any extra contextual information to add to the email.
d. Get the info from the applicable row in the spreadsheet.
e. Create a nicely formatted email and send it off.
From there, the person in charge of doing the referrals would simply run the script and feed it the required information. Clearly human error could fowl things up here, but without more details of exactly how you want this to work, it isn't really possible to define exactly how to best protect against human error. Reading up on Data Validation might give you a start on that front.
And if you are still completely lost, I happen to be a Google Apps Script tutor/consultant who often gives away free tutoring/consulting. See tutoringbyroger.com for more on that.
I hope that helps.

I need to get the body of an incoming email in Gmail and write it on a spreadsheet

Okay, so I have been looking tutorials but everything I find about receiving emails with google apps is confusing for me. I would like to know how I can get the body of an incoming email and write it on a cell of a Spreadsheet. I know that you can get a Spreadsheet cell and use it as the body of a sending email, but I was wondering if I could do the opposite.
Thank you very much :D
Just been doing some quick Googling about it and found this Github post:
https://gist.github.com/oshliaer/70e04a67f1f5fd96a708

google apps script to send spreadsheet pdf

I'm very new at this and I think I'm trying to do something a little complicated. Ultimately I'm looking to do the following: I would like to have a spreadsheet that upon a submit button does the following, sends spreadsheet to a specified email address, then increases a specified cell number by 1, then clears data that was entered in specific cells.
I have figured out how to increase a cell on a button push that's as far as I have gotten. Any chance someone would be able to point me in the right direction?
For your emailing you want to use MailApp.sendEmail()
The PDF conversion mentioned in the subject line is also pretty easy to use Spreadsheet.getBlob() or if you want to be a bit more verbose Spreadsheet.getAs('application/pdf')
Generally the GoogleAPI is pretty good at explaining a lot of the detail on how to connect to the google libraries

Emails within Google Sheets

I am hoping i can find a kind hearted person to help me if possible with some google sheets scripting.
I am looking for a way to automate something i currently have to do manually everyday. I take data from present day I have entered into a spreadsheet, copy it, paste it into and email and send it. I have used the Query function within Google sheets to help me separate who gets what information, that has made my life a tad bit easier.
I currently go to each tab, copy data, go to Gmail, paste data, type in the email address of the recipient, type in the subject, send, then go on to the next one 30+ times.
What I would like to do...
1. Click a menu item at top that says something like "Send Emails Now"
2. Once triggered, this would go to all (except 3, but i can just have these go to my own junk mail if too much) the tabs and send an email with the information contained only on that sheet to an email address in Cell A2
Email would have the subject "Call Parking Time XXXXXX" where XXXX is the date in a E1
Here is a copy of the current sheet I have, some reason it will not let me share the original. So i have updated the 20-Sioux Falls and 21-Frederick sheets to show what i mean.
https://docs.google.com/spreadsheets/d/1nOgZzwbKEUF4_adkjxkvmiiVwFtu-2OGCPJ0Wj_keQU/edit?usp=sharing
Thank you for your help in advance.
Although this is an older question, I still have a recommendation for you and other potential users facing the same problem.
I use a Google Sheets add-on called FormMule that should work as a great solution to your challenge here. It allows you to create personalized template emails, set conditions for your merge, and have multiple templates to various people based upon your chosen criteria.
You can also set a time trigger, form submission trigger, or manually trigger it through the add-on menu.
Although I agree with Zig, here are a few things that'll help you get started:
//1. Define your Custom Menu Item
function onOpen() {
var spreadsheet = SpreadsheetApp.getActive();
var menuItems = [
{name: 'Send Data', functionName: 'sendEmail_'}
];
spreadsheet.addMenu('Automated Emails', menuItems);
}
Tutorial for Sending Email (Although this one sends data in each row as a separate email but you should get the idea of what to do)
Sample for creating a table from Spreadsheet Data
This should give you a good head-start. Put pieces of these together and you should be pretty much good to go. And if you hit any roadblocks along the way, people on SO are always glad to help. :)