问题
There's really very little code I can show here. I'm calling a google sheets spreadsheet using the api with node.js.
Within the spreadsheet, I have created a bunch of filter views
. Is there a way to tell the api to call the filtered data instead of just getting all the data in the sheet.
const dataFromGoogleSheets = `https://sheets.googleapis.com/v4/spreadsheets/${
config.spreadsheetId
}/values:batchGet?ranges=${"Sheet1"}&majorDimension=ROWS&key=${
config.apiKey
}`;
UPDATE
sheets.spreadsheets.values.get(
{
spreadsheetId: "mySpreadSheetID",
filterViewId: 121321321,
title: "Filters"
}
)
回答1:
You cannot fetch data from Sheets API or Google Apps Script with an active FilterView.
As @Tanaike mentioned in the comments, you can fetch the criteria from the FilterView and reprocess it on top of the data.
You can also file a Feature Request for this on the Public Issue Tracker.
来源:https://stackoverflow.com/questions/58923823/get-google-sheet-filter-view-data-with-api-call