Button in email to change cell value in google sheets - google-apps-script

I am designing a ticketing system that runs through google forms and sheets. I want the agents to never have to interact with the actual sheet. I want to have a link/button in the email ticket where the agent can mark as resolved and the value in a cell in the sheet gets changed automatically.
Is this feasible?

It is possible and there are a couple ways to do it. I would suggest the below slightly different method than what your question asks (what if they accidentally click it!?).
Since you're already using google forms, I would send your people a link to another form that confirms a ticket should be closed. You code the link to pre-populate the ticket number to ensure that there's no human error in making sure they entered the proper ticket number.
See example to a form here with a link that will populate the form with a number from the link (I used your question #)
Once the user clicks submit, you can use that event to have your app script go modify your spreadsheet accordingly.

Related

Multiple OnFormSubmit trigger to specific spreadsheet

So, we have this task where we have a Google Form where a user submits data as a sign up for a mentoring service that gets passed on to a Spreadsheet and the user gets an e-mail as a sort of like confirmation that the sign-up did indeed happen. During this, the mentor that the user specified also gets an e-mail with some of the information that the user has sent, and a link that redirects them to a pre-filled Google Form that contains some of the information that the user submitted, and a drop-down question that basically serves as an attendance check.
Now, all of that mentioned already works. The problem is, the way it is set-up is that there are 2 Google Forms that direct to the same spreadsheet, just in different tabs. If I try to use OnFormSubmit as a trigger for the functions that allows for the emails to be sent, what happens is both OnFormSubmit triggers occur at the same time. I've seen multiple solutions to this problem here but none of them seem to work for me. Is there a way to manually script the OnFormSubmit function to let it work only when a specific form is passed?

How to ask a user for Sheets input, validate and process data?

Issue
Colleagues gather information on fairs and such and that information needs to be submitted. Currently they copy-paste this data in a Sheet and some data validations and such are applied on this sheet. However, data validation does not reject the input in case it's not an accepted value when you paste 2 or more values (it just gives a warning by marking the upper-right corner red). Furthermore, we are not able to set certain columns required.
Since this sheet is automatically imported in a database, it is important to have all required data present and with valid values.
Question
Would it be possible to have a Google Sites page that shows a Google Sheet, allows you to add data to this sheet and process this data when a submit button is clicked on the page?
Thoughts
I was able to find the Sheets integration in Google Sites, but the first issue I encounter is that users are not able to add data to this sheet through the Google Site.
I thought about doing this just in Sheets instead of a Google Sites solution, but this has some drawbacks:
Using a script would require user rights to edit the sheet that's automatically imported
Not very user friendly for simultaneous usage
Not an attractive interface
I'm not asking for a complete solution, but as I failed to find such a possibility I'd appreciate references to relevant documentation or opinions how this problem may be solved in the best way.

How would I implement for loop using google script to edit a google form?

I am very new to scripting on Google form. In fact, I just recently fount out about it.
So what I'm trying to do is that I want to create a form that consists of duplicated pages in accordance to a number that is chosen by the user.
For instance, the form asks the user "How many people will be participating in this event?" If the user types in 5, the form will make 5 duplicates of a page, in which all of those pages will ask for the details of each participant.
So is there a way create duplicates of a page using a for loop?
First, you'll need to implement using installable form-submit trigger which runs when a user responds to a form.
For more information, check these two versions of the form-submit trigger:
Google Forms events
Google Sheets events
Then, when triggered, you may want to create new documents using the append methods in Class Body.
See this related SO posts for more insights and sample codes:
Duplicating a page of a document and replacing text on each page
Google app script copy document page

Set a Google Form's elements when a user is entering for submit

Suppose I have the following:
Spreadsheet A
and I want to show the users a different question every time they enter a form for submitting (they see only one question in the form):
Form A
But there's another more difficult catch:
The form must check with the spreadsheet data which bands are still "unrated" by this user, and only show a question for one of those bands. If the user has rated every band in the spreadsheet, then the form should only show a "There are no more bands to rate" message.
And, the submit of the responses should be in this way:
Form A Responses
Is this possible with Google Forms, App Script, etc.?
not possible with apps script. you cannot modify the form at show time.
at most you can adjust the form (during onFormSubmit) for the next user to see. thus its impossible to customize for a specific user and you can also run into timing issues even if user is not important.

How to display form or dialog when user clicks in a Google Spreadsheet cell

I have a Google Spreadsheet, where each cell contains some plain text information. Now I need to pop-up a Google Form or UI Service dialog where user can enter that information field-by-field. Are there any way to get some event when user clicks/taps on a spreadsheet's cell? Spent a lot of time reading Google Apps Script documentation but found nothing helpful. Are there any way to get such event or maybe some workaround exists?
UPD: Now users enter data into cells as plain text. One can say that in-place text editor of a cell is their interface to editing this cell. What I'm trying to do is to change cell editing interface. I want users to be able to edit cell only through my form. When user fills form for a cell for the first time, the answer is saved to a separate sheet and the cell which user is trying to edit is populated with concatenation of user's answers. When user clicks on a cell that was previously populated, again my form appears pre-populated with prevous answers.
Currently, Google Apps Script triggers are restricted to the ones listed in the Understanding Triggers documentation page. There is not, currently, a trigger that will fire when a new cell becomes active -- the closest functionality is the onEdit trigger, which fires when any cell in the spreadsheet is changed.
A common use case is for user interactions with a Form or dialog to result in changes in a backend Spreadsheet. If I understood you correctly, it sounds like you are trying to do the reverse. You might want to rethink your approach here to make sure you really need a 'newActive' trigger functionality, or if you can make do with the existing triggers.
This is a really old question, but it seems that Google has added this functionality with onSelectionChange.
From the docs:
The onSelectionChange(e) trigger runs automatically when a user changes the selection in a spreadsheet.