Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
getRange array filtering on gsheets for custom menu

I am trying to create a custom side menu to use as a filter and edit tool for data on the spreadsheet. I have the html and css down but Ive hit a snag on filtering array data from getRangevalues filtering.

  {
const {google, containeranalysis_v1alpha1} = 
 require('googleapis');
 const keys = require('./key.json');

 const client = new google.auth.JWT(
keys.client_email,
null,
keys.private_key,
  ['https://www.googleapis.com/auth/spreadsheets']
 );

async function gsrun(cl){

const gsapi = google.sheets({version:'v4', auth: cl});

const opt = {
    spreadsheetId: 'XXXXXXXX',
    range: 'Data!A1:G'
};

let data = await gsapi.spreadsheets.values.get(opt);
let dataArray = data.data.values;
let newArray = dataArray.filter(function(checkDate){
    return checkDate === '09/16'; });

console.log(newArray);
 };

I am just trying to get a functional filter and then my next goal is to apply the filter parameters via html datePicker menu

enter image description here

*Edit| this is my script I was working on in node.j using an api. no appscript, but is essentially the same

I am still having trouble getting the array to function after applying the filter. im not getting any errors but i am also not getting any return values.

Date Patient Name PO Claim Submitted Frame Lens Status 09/15 xxxx xxxx PP Yes No Lens on Order 09/15 xxxx xxxx Yes Lens on Order 09/13 xxxx xxxx PP No No Frame & Lens on Order 09/16 xxxx xxxx Yes Frame & Lens on Order 09/16 xxxx xxxx Yes Frame & Lens on Order 09/16 xxxx xxxx Yes Yes No Lens on Order 09/16 xxxx xxxx NA No No Frame & Lens on Order 09/21 xxxx xxxx Yes No No Frame & Lens on Order 09/12 xxxx xxxx PP Yes No Lens on Order

this is the sheet. I am trying to filter this by date and then return all entire rows meeting the criteria

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are not handling a 2d array properly.

const dateColIndex = 0;
let newArray = dataArray.filter(function(row){
    return row[dateColIndex].getTime() === new Date('2021/09/16').getTime(); });
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda