sending automatic emails by google script - function

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.

Related

How to send Google form applicants to Org Charts

I need to automate the applicant and position ownership processes:
Forms> Acceptance> Plug them into an Org chart
Let me know if I can provide more use case info. I tried using Apps Script.
Thank you,
You can definitely use Google Apps Script to accomplish this.
First you need to create a Google Form the users will need to fill and get the data of that form in a spreadsheet. Once you have the spreadsheet you can start using Google Apps Script to create the users based on the data from the spreadsheet.
There is a code sample on how to create users in the Admin console using Google Apps Script here. I am assuming you will create your script so that it can add users based on the information introduced in the data from the spreadsheet, so you have the list of methods you can use here.
You would also need to add a trigger to your script so it starts running every time the spreadsheet gets edited, meaning that a user will get automatically created by the script every time someone fills the form and the responses get recorded in the spreadsheet.

Is there a way to generate gmail drafts from a contacts list located in a spreadsheet?

I would like to know whether it is possible to generate a list of gmail drafts in bulk grabbing the data from a google spreadsheet.
I have been using the mailapp function to send emails directly from a spreadsheet but this time I am looking for a way to store the emails as drafts to send them later manually one by one.
Thank you so much.
It is possible to create a draft using GmailApp. Here's link to the method
There is also an OAuth2 library (1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF) on GitHub here if you wanted then to try with UrlFetchApp?
You can also look at Google Sheets add-ons like SheetLink and use a formula to draft/send an email with Gmail. (reference)
=Gmail_CreateDraft("from","to","subject","message","options")

Google Sheets Script access searching contacts dialog

Is it possible to access my Google contacts from Google Sheets? I've created a simple spread sheet where I enter information for my drivers. Once the data on a row is entered it may be modified by other users that access the same sheet, but eventually - one of the users will need to send the data in that row to a specific driver via email. I currently accomplish this by using a Google Sheets Script to take the row values and build a mailto: hyperlink onEdit() in the last cell:
var emailtoString = '=HYPERLINK("mailto:changethis#address.com?&subject=' + subjectData + '&body=' + formatedData + '", "send email")';
e.source.getActiveSheet().getRange(row,9).setValue(emailtoString);
Which is working as expected and allows for whatever users is clicking the hyperlink to open the preformated gmail in their account - they can then delete the "changethis#address.com" email address that is allowing the hyperlink formula to create and then they have access to their contacts in the to: field - so if they start typing a user name, a selection list displays to let them select the contact.
This works, but separates the process of sending the email from the sheets script - just to get access to the drop down contacts list. If I could access that TO: dialog directly from the sheet cell - so the user sending the email is really just selecting an address from their contacts, then I could use the sheets script to just send the email message without having to open a gmail message and I could further flag another cell as "Message sent to emailaddress". By using the hyperlink it is making it difficult for me to figure out how to set a flag letting other users know an email has already been sent to this driver. So I am wondering if its possible avoid all this hyperlink creation and instead, just present the user(s) of the spread sheet with a selection dialog from the user accessing the sheets personal contacts so they can select someone to send the email and I can script sending the email rather than building the Hyperlink to open Gmail.
From the question
Is it possible to access my Google contacts from Google Sheets?
Yes it's possible. Use the Contacts Service (ContactApp)
Reference
https://developers.google.com/apps-script/reference/contacts
Related
Create a Contact Group via Google Spreadsheet

Display the result of a calculation in Google Sheet to the user after he sent a Google Form

I created a Google Form that send its results to a Google Sheet for further calculations. Therefore, I'd like to display the results of those calculations to the user once he has sent the Google Form (either instantly or via email).
How can I achieve this ? Should I use a module ? Or a Google Apps Script ?
Thanks for your time
Considering that, You are collecting data from multiple user into the spread sheet collect their email Id's as well along with other data,
How to get email Id column in spreadsheet?
Go inside google form edit mode -> see the settings icon from the right corner of the page > click on that -> check the Collect email addresses checkbox -> Save.
Now, you will have Email Address column in the spreadsheet.
Lets suppose you are receiving the marks of 3 subject, calculate the sum of those these 3 values, same for each users records(row) in loop or use VLOOKUP/ formula to calculate sum, get email address from the same row of the respective user and send mail to that user using MailApp api and add sum inside email body with some text formatting.
Perhaps, check out two addons for Google sheets, autoCract and Docotpus. We use them all the time to get and send student's results. They are very helpful.

send sms using Google Scripts on google spreadsheet

i want a script that sends a message to a particular cell number on event of an update in my spreadsheet or through a add menu button option.
i tried to find but couldn't see any option like that.
One of the simplest ways is to write a script to send it via email using your cell carriers email code.
Here's a list of codes https://20somethingfinance.com/how-to-send-text-messages-sms-via-email-for-free/ .
Under tools select script editor and basically just copy the following code in. Change up the EmailTo, Subject, and Body accordingly.
function sendText() {
var EmailTo = "your10digitNumber#CellcarrierCode";
var subject = "Whatever";
var body = "Text";
MailApp.sendEmail(EmailTo, subject, body);
}
In the script editor under Edit select current project triggers and setup however you want.
Adding a menu or setting up an onEdit even function in a document is pretty straightforward (just a few lines of code depending on the complexity of your application). Google Apps Script does not have built in functionality for SMS/Text messaging however.
If you want to accomplish this sms functionality, you will need to identify a company that offers an SMS/Text messaging API and access the API with a custom script. Twilio is a great tool (although not free) or you may find another API that fits your needs based on your region in this list of SMS APIs: http://blog.mashape.com/list-of-50-sms-apis/.
Once you have your service/API selected and set up and have the API Documentation, refer to the following Google Developers page to access the service API with Apps Script: https://developers.google.com/apps-script/guides/services/external.
If you're not well versed in using APIs, you can instead use MailApp to send e-mail or log any activity in another spreadsheet for tracking purposes. One other low-tech solution to consider is that spreadsheets have a built-in edit notification under Tools > Notification Rules.
I attempted to
try{
MailApp.sendEmail(phone+'#txt.att.net',subject,body);
}
catch(err){}
The email sent. It worked. BUT it did not send the text. HOWEVER, if I REPLIED to the email (from sent mail) to the phone plus carrier code it did go through. But only the reply.