Tell me more ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I need to copy and rename a base form (a spreadsheet) to several other forms in Google Docs. Imagine I have the following form:

  • My Base Form - @name (@course)

After running the script or whatever, I will end up with those forms:

  • My Form Copy - John Doe (Computer Science)
  • My Form Copy 2 - Donald (Arts)
  • ...
  • My Form Copy 15 - Andrea (Music)

Any idea on how can I do that?

share|improve this question
Can you share a doc with us? – Jacob Jan Tuinstra Feb 9 at 22:49
If this is about the question, never mind, I figured it out already :) – Dovyski Feb 12 at 15:54
Perhaps you can share this solution with us, Q&A style? – Jacob Jan Tuinstra Feb 12 at 17:19
Ok, I've shared my solution. I hope it can help. Thanks for the bootstrap, Jacob! – Dovyski Feb 25 at 14:15

1 Answer

After some research, I figured it myself. Here is my solution if someone faces the same problem and needs a script for that:

var BASE_FORM_ID = "0AlDgVsiNXDhjdFlRTFVBeG5rNmprb3kHNxd1ItSFE";

var aNames = [

  {name: "Prof. Fernando", course: "Course name"},
  {name: "Prof. Rafael", course: "Course name"}
];

function makeForms() {
    var aSpreadsheet;
    var aNewForm;
    var aCurrentName = "";
    var aBaseForm = DocsList.getFileById(BASE_FORM_ID);

    for(var i = 0; i < aNames.length; i++) {
        aCurrentName = aNames[i].course+" ("+aNames[i].name+")";
        aNewForm = aBaseForm.makeCopy("Evaluation for " + aCurrentName);  

        aSpreadsheet = SpreadsheetApp.openById(aNewForm.getId());

        Logger.log(aCurrentName + "  "+aSpreadsheet.getFormUrl());
    }
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.