Google Spreadsheet conditional email notification script - google-apps-script

I am studying Google Spreadsheet script coding but not working for me. I am trying to create a conditional automatic email notification script
I have a lead sheet and the first column of this is named as lead owner and I have given few names in dropdown in this column... I want that when I select a name from dropdown menu then this Google spreadsheet sends an email to that person's email id that you've assigned a new lead.
Can you please help me in this.
I have used IMPORTRANGE formula too which copy and paste that lead to a different sheet named to that particular lead owner.
I am stuck on this email notification. tried few add-ons but not successful. Please help.

Related

Is there a way to have a Google Form response trigger the creation of a new Google Sheet?

I do not have any experience with apps script. Something I am trying to learn currently and this is my first project that I will be working towards.
My company that I work for use a mundane spreadsheet which is used as our purchase document. I have translated it to a Google Sheet that looks like this: https://docs.google.com/spreadsheets/d/1mZlzeu9-9Mb0B1VmlNSJDfCxELqci4KRc_HFbRt3NwM/edit?usp=sharing
Currently, anyone that makes a purchase needs to fill out this spreadsheet and send along a copy of the receipt of the purchase via email to our billing person.
The Google Form I want to create to streamline this will contain basic information like the name of the person filling it out and an email address. I would add some of the items below along with a Google Drive Upload so that the person can upload a picture of the receipt(s).
What I would want to have happen is on a Google Form response, I would like apps script to do the following, in this order:
Create a copy of the spreadsheet linked above and Title it as "[Team Name] [Date] Credit Card Request"
Fill it with the information that is needed:
Date of Transaction
Amount Request
Vendor Name
Program Name (I think this can be done away with because of Team)
Team
When the spreadsheet is filled out, I would like to then email the billing person a completed XLSX copy along with the file attachments that were uploaded for that response.
3a. Sending a copy of the same email to the person filling out the form originally would be a plus.
Because of the format of this spreadsheet, when the team is specified, I am hoping I can have the Apps Script set the value of the corresponding cell for that team (a checkbox) to TRUE.
I may ask for some assistance with this later on, but I am wondering, **is this possible to do? **
My apologies, I do not have any script experience, not sure where to even start.

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

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.

Auto create new sheet and email a summarized view of responses in google forms

I'm doing performance measurement for my office. And I probably just need to be pointed in the right direction. But here goes.
I want to make a form that employees can fill out every day, these responses go to a google spreadsheet.
I want this spreadsheet to create a new sheet for every week and then at the end of every month email the results to my boss.
What are my options for auto creating a new sheet, emailing results and summarizing?
Start by reviewing the Managing Responses for Google Forms quickstart. Then look at Installable Triggers, the SpreadsheetApp service and the FormApp service.
One strategy for what you need would be to have a script that (based on a weekly trigger), creates a new spreadsheet and then resets the Form's destination to that spreadsheet.
That script can also have another (monthly) trigger that uses MailApp to send a summary email to whomever you choose.

Google Sheets : format a cell differently based on user viewing the sheet?

Is it possible to format a cell (set the background color, for instance) based on the user currently viewing the sheet?
I'm using Google Sheets for an employee scheduling application and would like to highlight the name of the employee currently viewing the sheet everywhere that name appears on the schedule.
So if Tom opens the sheet, all cells with "Tom" in them would appear highlighted. If Bob opens the same sheet, all cells with "Bob" in them would appear highlighted.
Thanks in advance!
According to Google Apps Script:
getActiveUser()
Gets information about the current user. Returns a User object
describing the current user. In limited-privilege executions (such as
in response to onOpen or onEdit events), we only return the identity
of the active user if both the user and the script owner are part of
the same domain. This is to protect the privacy of consumer users, who
may not want their email address exposed. For more information, see
the active user entry in the Glossary.
So if you have someone using the spreadsheet from within your domain (for business, education), then you could have an onOpen script and attempt a filter/highlight function based on your parameters and script.
Cheers!
You could create specific filter views for your team. Select Data > Filter Views and name your filter view after the teammate. Filter views allow different people to view the same sheet differently. I may be wrong about this, but I don't believe there is a way to turn the filter views on and off programmatically through GAS, but each filter view has a unique URL, so you could use getActiveUser() in conjunction with an alert prompt linking the active user to their personal filter view.