Google Drive Picker ViewId.SPREADSHEET显示电子表格和表单

时间:2018-01-01 09:38:39

标签: google-apps-script google-drive-api

有没有办法将Google云端硬盘选择器仅限制为电子表格。我正在添加电子表格视图ID(根据Google的文档中的以下脚本),但它会同时显示表单和表单。

$this->email->initialize($config);

2 个答案:

答案 0 :(得分:2)

我认为您可以通过setting the MIME类型执行此操作。可以找到MIME类型here.

PickerBuilder.setSelectableMimeTypes(string)

答案 1 :(得分:1)

首先,创建视图(注意view.setMimeTypes):

// Instruct Picker to display only spreadsheets in Drive. For other
// views, see https://developers.google.com/picker/docs/#otherviews
var view = new google.picker.DocsView(google.picker.ViewId.SPREADSHEETS);
view.setMimeTypes('application/vnd.google-apps.spreadsheet');
view.setIncludeFolders(true);

然后将视图添加到选择器:

var picker = new google.picker.PickerBuilder().addView(view)