I am trying to get the developer metadata about a spreadsheet using the Google Script API, as found on this website.
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata/search
I have tried the following, however I am getting no response back? Can anyone see where I am going wrong?
var ss = SpreadsheetApp.getActiveSpreadsheet();
var fileId = ss.getId();
var token = ScriptApp.getOAuthToken();
var paramsPost = {
method: 'post',
headers: {
Authorization: 'Bearer ' + token
},
muteHttpExceptions: true,
contentType: 'application/json',
payload: JSON.stringify({
dataFilters: [{
developerMetadataLookup: {
locationType: 'COLUMN'
}
}]
})
};
var url = 'https://sheets.googleapis.com/v4/spreadsheets/' + fileId + '?developerMetadata:search';
var res = UrlFetchApp.fetch(url, paramsPost);
var data = JSON.parse(res.getContentText());
You no longer need to use the REST API directly to access developer metadata.
As of November 14, 2018, methods to access developer metadata were added to the built-in Spreadsheet service. See Release Notes for details.
In order to use the method of spreadsheets.developerMetadata.search of Sheets API, please modify the endpoint as follows.
var url = 'https://sheets.googleapis.com/v4/spreadsheets/' + fileId + '?developerMetadata:search';
var url = 'https://sheets.googleapis.com/v4/spreadsheets/' + fileId + '/developerMetadata:search';
?
of '?developerMetadata:search'
is /
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.