Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

623
Views
Google App Script: Get values filtered by a slicer

Is there a way to get a range of values filtered by a slicer/multiple slicers using App Script? My understanding is that slicers work like a filter view which are not "hard" filters. I tried .getRange().getValues() but it returns all the data without the slicers being applied.

I have a source data in one sheet and a pivot table with slicers in another sheet. I want the user to open the sheet with the pivot table, filter the table using the slicers and then run a script which would get the filtered range from the table.

Using the below code I see that the script gets all the data even when the slicers are applied:

 var activeSheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
 var vals = activeSheet.getRange("A2:A").getValues();
 var numOfResults = vals.filter(String).length;
 Logger.log(numOfResults);

Test sheet: https://docs.google.com/spreadsheets/d/1pmazwEQp37Dkz41X2EjHmHEpONKqBD4g-Zhq0KuBYdU/edit?usp=sharing

Thanks a lot for any help!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!