I am using a code which closes the FORM at specified time. So what happened is some students are failing to submit it before the time limit and their responses are not being recorded.
Is there any way to force auto-submit a google form at specified end-time for all the users who are writing the quiz lets say!
Any ideas are welcome.
You can check this documentation about Installable Triggers which let Apps Script run a function automatically when a certain event occurs. It is similar to simple triggers for Google Apps like onOpen(), but they can respond to additional events, and they behave differently.
There are several installable triggers for Google Apps and you can use an installable form-submit trigger that runs when a user responds to a form.
Be noted that there are two versions of the form-submit trigger, one for Google Forms itself and one for Sheets if the form submits to a spreadsheet.
Related
I have a "hide sheets" function. I've tried using it as an onOpen function, and also with a On Open trigger.
It works fine if an Editor opens the GS.
But if a Viewer opens the GS, it doesn't work at all.
If it's an On Open trigger, I get an error email that "Authorization is required to perform that action."
If it's called as an onOpen function, it just doesn't work, but also doesn't generate any errors.
Is there a way to make this work for Viewers?
Viewers can't execute scripts including those called by simple triggers like onOpen
One option among many others is to have one spreadsheet for editors and another for viewers then somehow send the changes made by the editors to spreadsheet shared with viewers.
Related
Google Spreadsheet - Show sheets depending on type of user
Getting all viewers of spreadsheet using App Script
Consideration
onOpen trigger should not perform sensitive actions, at most create a menu.
A simple trigger won't be able to run under this low privileged scope (viewer-only).
A better flow would be to show additional sheets to users who have sufficient permissions, not the other way around.
Reference
Triggers Restrictions
I want to run a Google App Script function every time a change is made to my Google Doc. I have found onChange and onEdit triggers which are only available for Google Spreadsheet. I am sure there must be an edit/change trigger for Google Doc as well.
Unfortunately there are no onEdit(), onChange() triggers for Google Docs.
The triggers available for Google Docs are the following:
onOpen() triggers both simple and installable;
time driven triggers;
onInstall() simple triggers.
What you can do instead is to use a time driven trigger so in this way even though the changes are not directly triggering the execution, the trigger will still run how often you want it to.
Last but not least, you can file a Feature Request on Issue Tracker where you specify the details needed.
Reference
Apps Script Trigger;
Google Issue Tracker.
I have a Google Forms Quiz linked to a Google Sheet and an Apps Script 'From spreadsheet - On form submit' trigger linked to an Apps Script. Intermittently, this trigger fires twice causing a problem for my application.
I thought multiple versions of my AppScript may have inadvertently been deployed in parallel. But I have made sure to delete all other versions and 'Deploy as web app...' using a new version number with 'Only myself' having access to the app.
I have also tried using a lock in the script to limit execution to one at a time and have tested whether double-clicking the 'Submit' button on the Google Forms Quiz will cause this behaviour.
I would expect the trigger to fire once per Google Forms Quiz submit button press.
In the end the solution to this problem was to handle the spurious double OnSubmit events by calling SpreadsheetApp.flush(); to ensure that my spreadsheet changes were committed before processing any second firing of the OnSubmit event. In this way my application was able to handle the issue.
Can someone accurately describe the trigger criteria for Gmail Add-on scripts? Apparently, the trigger is not invoked each time the user navigates between Gmail conversations.
The only documentation I can find is https://developers.google.com/gmail/add-ons/how-tos/building#note1, which states
the only contextual trigger type available is unconditional, which triggers for all emails regardless of content.
I interpreted this to mean that the trigger is invoked every time the user navigates to a different gmail conversation, however, that is not the case:
The first time I navigate to a some Gmail conversation, the add-on trigger fires. And when I navigate to another conversation using the the “Newer” or “Older” angle-bracket button, the trigger is again invoked for the new conversation. But when I navigate back to the first page using an angle bracket button, the add-on trigger does not fire. (Easy enough to show this by displaying a timestamp when each UI card is created.) There seems to be some kind of internal caching going on — is there any way to disable this, or otherwise run my add-on script each time the user navigates between Gmail conversations?
you can use ActionResponseBuilder.setStateChanged(), to clear the cache
link: https://developers.google.com/gmail/add-ons/how-tos/interactions
Currently, Google Apps Script doesn't have triggers for Gmail events so the trigger will not invoke every time, the user navigates to a different Gmail conversation. Whenever a new message open it will invoke trigger, contextual trigger. You can also tryout time-driven trigger which invokes after each time interval. To use time-driven trigger open your project on https://script.google.com/. In Apps Script Editor, navigate to Edit -> All your triggers. If there is no trigger then setUp one and Save. See this example Create Time-driven trigger in Gmail-add on
Refer this link for more information How do I detect when I view an email in gmail with google-apps-script script? I think this might be helpful.
It seems that OnEdit only works for spreadsheet?
I have a google form to capture data and sends to user's Calendar. But is there a way to append data if user decides to edit the form submission?
I can't find a trigger for 'edit' of form submission.
Have a look at the google apps script guides.
https://developers.google.com/apps-script/guides/triggers/#available_types_of_triggers
There you see that the onEdit trigger is only available for Sheets. However, it seems you could use a installable trigger that will fire on form submit.