I would like to use the Driver Picker widget to select a spreadsheet and save the file ID of the spreadsheet to a data model.
I have the selectedDocUrl field of the Drive Picker set to the fileID column in my model (@datasource.item.fileID
) but as expected this saves the entire URL of the file to the model.
I am looking to capture the file ID only.
Full URL:https://docs.google.com/spreadsheets/d/1Q4z5ZsE5eDm14MysAdb-CnApSNlzToMdXTTCgrN6BNA/edit
File ID:1Q4z5ZsE5eDm14MysAdb-CnApSNlzToMdXTTCgrN6BNA
Use the onDocumentSelect event handler of the drive picker and do the following:
widget.datasource.item.fileID = result.docs[0].id;
Keep in mind that the above will work if the datasource is properly binded.