codepants
codepants

Reputation: 55

Copy sections from one form to another form

I am using Scripts to update multiple Google Forms that share the same first two pages/sections, but have an entirely different third page/section.

For instance,
Form 1: Page 1 > Page 2 > Page 3 > Submit
Form 2: Page 1 > Page 2 > Page 4 > Submit
Form 3: Page 1 > Page 2 > Page 5 > Submit

I KNOW I can put a question on page 2 that directs to either 3, 4, or 5 depending on the answer to that question. However, the customer has requested three distinct forms with different URLs, ruling out that possibility.

Current, I update all three forms separately:
1. Remove everything from Form 1, then rebuild it from scratch.
2. Remove everything from Form 2, then rebuild it from scratch.
3. Remove everything from Form 3, then rebuild it from scratch.

My question is: is there any way to generate pages 1 and 2, then "copy" them to all three forms?
1. Rebuild pages 1 and 2 (say on a dummy form).
2. Copy pages 1 and 2 to Form 1. Rebuild page 3.
3. Copy pages 1 and 2 to Form 2. Rebuild Page 4.
4. Copy pages 1 and 2 to Form 3. Rebuild Page 5.

I also know I can make one form with pages 1 and 2, then make a copy of that form three times and work with the copies. However, the customer wants the URLs to remain the same through form updates. I cannot work with copies because copying a form generates a new URL for it. I have to update the already existing forms.

Thoughts?

Upvotes: 0

Views: 1318

Answers (1)

Wicket
Wicket

Reputation: 38140

On this question I see several underlying issues:

  1. Form structure

    • FormApp manage questions, "pages" and "sections" by using several kinds of items that could be handled by using the Interface Item for all of them. There aren't containers or parent-child relationship between these items.
  2. Copy items

    • FormApp doesn't include a copy method for items but it's possible to set the same property object to several items.
  3. Keep the same URL

    • Google Forms URLs are unique and can't be reused. There are reports of forms that become unusable so it's better to be prepared in case that his happens (don't make promises that the form URL will not ever change). One way is to use a parameter to handle form ids/URLs instead of hardcoding them.

Upvotes: 1

Related Questions