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

560
Views
Google Apps Script: How to find column number of specific value in array?

What I'm trying to achieve is to get the column number of a specific cell. If the cell value in the array equals to the value of today's date, then give back the column number of that cell.

dateArrayD = 1 row containing all the dates from January 1 to December 31, formatted

dateTodayD = the date today, formatted

So if dateTodayD equals dateArrayD, then dateCol would be the column number. I simply can't find a solution for this.

for(var z = 0; z < dateArrayD.length; z++){
    if(dateTodayD !== dateArrayD[0][z]){
      var dateCol = z;
    } // end if
  } // for end
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This function adds a line feed and row , column to each cell.

function calcRowColumn() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Sheet0');
  const sr = 4;//data start row
  const sc = 4;//data start column
  const rg = sh.getRange(sr,sc,sh.getLastRow() - sr + 1, sh.getLastColumn() - sc + 1);
  const vs = rg.getDisplayValues();
  vs.forEach((r,i) => {
    let row = i + sr;
    r.forEach((c,j) => {
      let col = j + sc;
      vs[i][j] += `\n${row},${col}`;
      
    })
  })
  rg.setValues(vs);
}

Start Data:

enter image description here

End Data:

enter image description here

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!