如何导入“文件上传"使用google-apps-script的google形式的模块 [英] How to import "File upload" module in google form using google-apps-script
问题描述
我可以使用 google-apps-script 创建一个小的google表单.其中包括文本,单选按钮等.但是如何使用google-apps-script
I am able to create a small google form using google-apps-script. Which includes texts, radio buttons, etc. But how to include the file upload module using the google-apps-script
下面的示例代码从Google表格中读取数据并动态创建Google表单.
Sample Code below reads data from the google sheet and creates google form dynamically.
function myFunction() {
try {
var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet1');
var range = ss.getDataRange();
var data = range.getValues();
var numberRows = range.getNumRows();
var numberColumns = range.getNumColumns();
var firstRow = 1;
var form = FormApp.create(data[0][1])
for (var i = 1; i < numberRows; i++) {
var questionType = data[i][0];
if (questionType == '') {
continue;
} else if (questionType == 'TEXT') {
var getValue = data[i][3];
form.addTextItem()
.setTitle(data[i][1])
.setHelpText(data[i][2])
.setRequired(getValue);
} else if (questionType == 'PARAGRAPH') {
form.addParagraphTextItem()
.setTitle(data[i][1])
.setHelpText(data[i][2])
.setRequired(true);
} else if (questionType == 'IMAGE') {
var img = UrlFetchApp.fetch(data[i][6]);
form.addImageItem()
.setTitle(data[i][1])
.setHelpText(data[i][2])
.setImage(img)
} else {
continue;
}
}
} catch (error) {
return error.toString();
}
}
推荐答案
Forms上没有使用Google Apps脚本包含文件上传模块的方法.我认为这可能是一个很好的实现功能:值得在Google Public Issue Tracker上打开功能请求以指明其需求.
There isn't a method on Forms to include a file upload module using Google Apps Script. I believe this may be a good feature to implement: it may be worth to open a Feature Request on the Google Public Issue Tracker specifying the need of it.
我鼓励您这样做,因为这将有助于实现它.
I encourage you to do it because it will help to make possible its implementation.
Google Public Issue Traker: https://issuetracker.google.com/
Google Public Issue Traker: https://issuetracker.google.com/
此特定问题的跟踪器位于此处: https://issuetracker.google.com/issues/64924665
The tracker for this particular issue is here: https://issuetracker.google.com/issues/64924665
这篇关于如何导入“文件上传"使用google-apps-script的google形式的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!