Change form palette via google scripts

夙愿已清 提交于 2019-12-01 18:37:33

For the moment you can't, FormApp works with the first version of Forms, so for the moment no templates available programmatically.

Last news on the subject here

Good to note that once you generate a form programmatically, you can then edit it just like a regular form. You get the link to the editable page from form.getEditUrl().

I was facing the same issue here and found a workaround: create a "Template Form" with the proper theme you want, then you make a copy of it and do your coding to the new copied form.

The problem is, if you want to custom each form with a theme, it would need several template forms, and the code should be able to select the correct template. However, this is not my case. Here is a sample code:

var file = DriveApp.getFileById('your-template-form-id').makeCopy();
var form = FormApp.openById(file.getId());

Just make sure you remove the single question that is created within the template form if you're adding questions dinamically, else, add the questions you need.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!