bp123
bp123

Reputation: 3417

Get google sheet filter view data with api call

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"
    }
)

Upvotes: 1

Views: 2624

Answers (1)

ZektorH
ZektorH

Reputation: 2760

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.

Upvotes: 1

Related Questions