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

189
Views
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 answers
Answer question

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 Report
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!