Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

624
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda