Search code examples
hyperlinkgoogle-sheetsgoogle-forms

How to pre-fill multiple fields in Google forms via a spreadsheet hyperlink code?


What I'm basically doing is creating a whole column in a Google Form's answers Spreadsheet, with a formula within its cells such as this:

=hyperlink("https://docs.google.com/forms/d/e/FORM-ID/viewform?entry.ENTRY#1-ID&entry.ENTRY#2-ID="&A1&B1,"Update Data")

Where the:

  • FORM-ID is the identifier of the (parent) Google Form,
  • ENTRY#1-ID and ENTRY#2-ID are the items from the Google Form (accessed via the "Get pre-filled link"),
  • A1 and B1 are target fields within the Spreadsheet that contain the data to be pre-filled,
  • and "Update Data" is the displayed text within the Spreadsheet field.

Now, my problem is that A1 and B1 are both injected into ENTRY#2-ID, instead of A1 going into ENTRY#1-ID and B1 into ENTRY#2-ID respectively.

How can I explain to the hyperlink code to separate the entries? I cannot break the link into separate parts, and I cannot insert Spreadsheet field codes between the quotes.


Solution

  • Clever thought to pre-fill without script. I got it to work using the A1 & B1 references. The entry.835398034= and entry.2133553026 are from the prefill form url.

    =hyperlink("https://docs.google.com/forms/d/e/1FAIpQLSdm6HaK-4qDEERngZh6Z6DH0_iT4uUjPMINVcBDu5pEiKH_Fw/viewform?entry.835398034="&A1&"&entry.2133553026="&B1,"Update Data")
    

    Thanks for the idea.