Reputation: 53
Working with Google APIs (Sheet, v4) in JavaScript, I need to verify the origin of a sheet, either by using an owner ID or the Drive ID where it is hosted (regardless of the folder).
I looked at the properties of the Spreadsheet as well as the documentation but couldn't find this essential information. Thank you. Thank you.
Here is the documentation consulted: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata
{
"spreadsheetId": "1kbxkHPzlHy35v9hNSE8pxJljF_MsTBqXER2xIFzm0W0",
"properties": {
"title": "Goco",
"locale": "fr_FR",
"autoRecalc": "ON_CHANGE",
"timeZone": "Europe/Paris"
}
}
No property contains any information about the owner or the Drive.
Upvotes: 2
Views: 904
Reputation: 11278
You can use the Drive API to get the email address of a file give the ID.
function getOwner() {
var file = DriveApp.getFileById(spreadsheetId);
Logger.log(file.getOwner().getEmail());
}
Upvotes: 1