I need to get specific data row of this table:
Google Sheet Data Base
, for that I am using the following filter parameter:
var filter = {
"dataFilters": [
{
"developerMetadataLookup": {
"metadataValue": "[email protected]"
}
}
]
};
but the current result is as follows:
response: {
"spreadsheetId": "1chGysP"
}
The result I need is something like the following:
response: {
"range": "'Hoja 1'!A4:D4",
"majorDimension": "ROWS",
"values": [
[
"3",
"domain4",
"[email protected]",
"Active"
]
]
}
I found a similar question to mine, and it seems to work but I think I wouldn't be taking advantage of using the api directly like checking quotas, reporting dashboard and so on. How can I use the Google Sheets (v4) API getByDataFilter to return a specific row of data?
My complete code is as follows:
//function for bot that runs asynchronously from Google Apps Script
function consultData(){
var url = 'https://sheets.googleapis.com/v4/spreadsheets/1chGysP/values:batchGetByDataFilter?key=KAIzaSy'
var service = getOAuthService();
service.reset()
var filter = {
"dataFilters": [
{
"developerMetadataLookup": {
"metadataValue": "[email protected]"
}
}
]
};
var params = {
headers: {
Authorization: 'Bearer ' + service.getAccessToken()
},
method: 'get',
contentType: 'application/json',
payload: JSON.stringify(filter),
muteHttpExceptions: true
};
var response = UrlFetchApp.fetch(url, params).getContentText();
Logger.log('response: ' + response);
return response;
}
API reference: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/getByDataFilter
Execute the app as: User accessing the web app
andWho has access to the app: Anyone
? The latter can use the TextFinder. Ref – Tanaike