Reputation: 29
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!
Upvotes: 1
Views: 3355
Reputation: 13469
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:
Upvotes: 3
Reputation: 1
Press CTR + Right side arrow - for last cell of row Press CRT + Down side arrow - for go to the last column
Upvotes: -1