Record Time taken to complete a google form


I am trying to record the total time taken to complete and submit a Google form. My logic is simple that the following code would record and put the timestamp as a multiple choice option. Then upon submitting the form, we get a time stamp anyway but along with that, we would get the initially recorded timestamp as an answer to that question.

This is my cute little code:

function initial() { var form = FormApp.getActiveForm(); form.getItemById(1589920082).asMultipleChoiceItem().setChoiceValues([new Date()]); }

I have set the trigger as OnOpen but surprisingly, it does not renew the timestamp every time I open the form. Theoretically, it should record the time when the form was open but I think I am missing something here.

On the other hand, if I change the trigger to OnSubmit, it starts recording fresh timestamps every time I submit the form. But I don't want that as we get submission timestamps anyway. What I am trying to record is the time the form was open.


Unfortunately you cannot have any code executed when user opens form for filling in, as onOpen trigger is not supposed to be run in this case:

<a href="https://developers.google.com/apps-script/guides/triggers/#onopen" rel="nofollow">https://developers.google.com/apps-script/guides/triggers/#onopen</a>


The onOpen() trigger runs automatically when a user opens a spreadsheet, document, <strong>or form that he or she has permission to edit. (The trigger does not run when responding to a form, only when opening the form to edit it.)</strong>


There is an open <strong>feature request in Google Issue Tracker</strong> to introduce some kind of onOpen trigger when form opened for response, you can "star" it to make it more possible to appear: <a href="https://issuetracker.google.com/issues/63985842" rel="nofollow">https://issuetracker.google.com/issues/63985842</a>


  • Null Exception handling in foreach loop
  • vuex getter with argument written in Typescript
  • How to display image in img ASP control?
  • How to add validation to existing google form items via script?
  • Is there an more ideomatic way to split a stream by some predicate?
  • Background Image with 100% height: Need to fill page
  • ZK inner class tree property not readable
  • Twilio: programmatically join conference and play command or sound file?
  • JavaFX - Border radius Background color
  • document.getElementsByTagName(“a”) misses a link
  • Indirect parameter substitution in shell script
  • Longest Common Subsequence among 3 Strings
  • Generating a bash script from a bash script
  • x86 multi-byte NOP and instruction prefix
  • Pipeline in Windows batch backquote
  • Designing a simple bandpass/bandstop filter in Matlab
  • How to make delete key- delete all selected edit text in custom android keyboard
  • KRL RSS parser: Handle encoding issues?
  • why is deleting this object causing problems?
  • shell script for grabbing data and subtracting
  • How to get a list of all blobs in a repository in Git
  • Why do I link my jquery inside a document.write?
  • QVideoWidget: Video is cut off
  • iOS background and images seem to not scale properly for retina display
  • Custom partiotioning of JavaDStreamPairRDD
  • Binding ContextMenu Tag to Owner
  • How can I get process name of specific PID with ps command in alpine
  • Connection pooling with URLConnection?
  • richtextbox to string
  • Why querying a date BC is changed to AD in Java?
  • Row Count Is Returning the incorrect number using RaptureXML
  • Illegal mix of collations for operation for date/time comparison
  • Release, debug version and Authorization Google?
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • Hits per day in Google Big Query
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?