1

I have a sheet filled with data in each column and they all have different length in rows. Since I will need to audit the data everyday at 4pm, but other people will continue to add data in each column at the same time, so I am trying to find the last cell of every column and highlight that cell with value into red so I know its a cutoff.

But i am wondering how to find the last cell with value of every column and highlight it into red with Google Apps Script?

Thank you!

bluery
  • 29
  • 1
  • 4
  • Welcome. The question is too broad. Please add a brief description of your search/research efforts. Ref. [ask]. – Rubén Jan 30 '19 at 01:18

2 Answers2

3

You may refer with this thread: Google Script - get last row of specific column.

You can also use the following code:

function findTheLastRow(){
  var ui = SpreadsheetApp.getUi();
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getActiveSheet();

  var range = sheet.getRange("B1:B").getValues();
  var filtered_r = range.filter(String).length;

  ui.alert("Column B's last cell is number: " + filtered_r + " and its value is: " + range[filtered_r - 1][0]);
}

This script counts the amount of cells that have a value in a column, so the cells above the last cell needs to have a value in order to get the right result.

You may also check this link for additional reference:

abielita
  • 13,147
  • 2
  • 17
  • 59
-1

Press CTR + Right side arrow - for last cell of row Press CRT + Down side arrow - for go to the last column

  • this isn't an apps script answer, which was the question. @bluery is this not the answer here: https://stackoverflow.com/questions/17632165/determining-the-last-row-in-a-single-column, plus looping through all the columns? – P Burke Jan 29 '19 at 11:02