Class PlatformDataSource Stay organized with collections Save and categorize content based on your preferences.
Page Summary
PlatformDataSource is used for populating items in a multiselect menu within a SelectionInput widget.
This feature is exclusively available for Google Chat apps and cannot be used with Google Workspace add-ons.
You can set the data source using
setCommonDataSourcefor Google Workspace data orsetHostAppDataSourcefor populating spaces in a multiselect menu.
For aSelection widget that uses a multiselect menu, a data source from GoogleWorkspace. Used to populate items in a multiselect menu.
constplatformDataSource=CardService.newPlatformDataSource().setCommonDataSource(CardService.CommonDataSource.USER,);constmultiSelect=CardService.newSelectionInput().setType(CardService.SelectionInputType.MULTI_SELECT).setFieldName('contacts').setTitle('Selected contacts').setMultiSelectMaxSelectedItems(5).setMultiSelectMinQueryLength(1).setPlatformDataSource(platformDataSource);
Only available for Google Chat apps. Not available for Google Workspace add-ons.
Methods
| Method | Return type | Brief description |
|---|---|---|
set | Platform | Sets the data source from Google Workspace. |
set | Platform | Sets the drive data source spec from Google Workspace. |
set | Platform | Used to populate spaces in multiselect menu. |
Detailed documentation
setCommonDataSource(commonDataSource)
Sets the data source from Google Workspace.
constplatformDataSource=CardService.newPlatformDataSource().setCommonDataSource(CardService.CommonDataSource.USER,);constmultiSelect=CardService.newSelectionInput().setType(CardService.SelectionInputType.MULTI_SELECT).setFieldName('contacts').setTitle('Selected contacts').setMultiSelectMaxSelectedItems(5).setMultiSelectMinQueryLength(1).setPlatformDataSource(platformDataSource);
Parameters
| Name | Type | Description |
|---|---|---|
common | Common | The data source to be set. |
Return
Platform — This object, for chaining.
setDriveDataSourceSpec(driveDataSourceSpec)
Sets the drive data source spec from Google Workspace.
constdriveDataSourceSpec=CardService.newDriveDataSourceSpec().addItemType(CardService.DriveItemType.DOCUMENTS).addItemType(CardService.DriveItemType.FORMS);constplatformDataSource=CardService.newPlatformDataSource().setCommonDataSource(CardService.CommonDataSource.DRIVE).setDriveDataSourceSpec(driveDataSourceSpec);constmultiSelect=CardService.newSelectionInput().setType(CardService.SelectionInputType.MULTI_SELECT).setFieldName('files').setTitle('Drive Files').setMultiSelectMaxSelectedItems(5).setMultiSelectMinQueryLength(1).setPlatformDataSource(platformDataSource);
https://www.googleapis.com/auth/drive.file) to manifest.Parameters
| Name | Type | Description |
|---|---|---|
drive | Drive | The drive data source spec to be set. |
Return
Platform — This object, for chaining.
setHostAppDataSource(hostAppDataSource)
Used to populate spaces in multiselect menu.
constchatSpaceDataSource=CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);constchatClientDataSource=CardService.newChatClientDataSource().setSpaceDataSource(chatSpaceDataSource);consthostAppDataSource=CardService.newHostAppDataSource().setChatDataSource(chatClientDataSource);constplatformDataSource=CardService.newPlatformDataSource().setHostAppDataSource(hostAppDataSource);constmultiSelect=CardService.newSelectionInput().setType(CardService.SelectionInputType.MULTI_SELECT).setFieldName('contacts').setTitle('Selected contacts').setMultiSelectMaxSelectedItems(5).setMultiSelectMinQueryLength(1).setPlatformDataSource(platformDataSource);
Parameters
| Name | Type | Description |
|---|---|---|
host | Host | The data source to be set. |
Return
Platform — This object, for chaining.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-03 UTC.