Existe uma maneira de limitar o seletor do Google Drive apenas para planilhas. Estou adicionando a id de visualização da planilha (de acordo com o script abaixo da documentação do Google), porém ela está mostrando planilhas e formulários.
function createPicker(token) {
if (pickerApiLoaded && token) {
var picker = new google.picker.PickerBuilder()
// Instruct Picker to display only spreadsheets in Drive. For other
// views, see https://developers.google.com/picker/docs/#otherviews
.addView(google.picker.ViewId.SPREADSHEETS)
// Hide the navigation panel so that Picker fills more of the dialog.
.enableFeature(google.picker.Feature.NAV_HIDDEN)
// Hide the title bar since an Apps Script dialog already has a title.
.hideTitleBar()
.setOAuthToken(token)
.setDeveloperKey(DEVELOPER_KEY)
.setCallback(pickerCallback)
.setOrigin(google.script.host.origin)
// Instruct Picker to fill the dialog, minus 2 pixels for the border.
.setSize(DIALOG_DIMENSIONS.width - 2,
DIALOG_DIMENSIONS.height - 2)
.build();
picker.setVisible(true);
} else {
showError('Unable to load the file picker.');
}
}
Primeiro, crie uma visualização (nota 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);
em seguida, adicione a visualização ao seletor:
var picker = new google.picker.PickerBuilder().addView(view)
Este artigo é coletado da Internet.
Se houver alguma infração, entre em [email protected] Delete.
deixe-me dizer algumas palavras