How to Get The Last Row - Google Sheets Apps Scripts - Array Methods Part 10

preview_player
Показать описание
In this tutorial learn how to get the last row of data in Google Sheets using Apps Script. We'll go over several methods of getting the last row, including array version using .every() array method in JavaScript.

Array Methods Series Part 10

#javascript #appsscript
Рекомендации по теме
Комментарии
Автор

Thanks very much. A teacher is really great!

haihuynhthanh
Автор

The best explanations google tables! Keep up the good work!

SPA_developer
Автор

Thank you so, so much for this intermediate series!

testaccount
Автор

Great guide. But one question - should overwrite the existing function names? Like getLastRow?

PawelGrabiec
Автор

It works for me. Thank you so much for the lessons!

RoseLK
Автор

wow! it's very helpful, Thank you

tonmoyahmed
Автор

mil gracias, buen video, buena explicacion, sigue haciendo videos

carmencastro
Автор

Hi there you have so much content on YouTube I'm having trouble finding the videos in the right order, have you? or can you ? put up a playlist somewhere of all the videos in the correct order? It would be much appreciated as I go through them all. Many thanks and tanks again for all this work it's really a fantastic resource.

dohatransmission
Автор

Hi, so when I tried to get the last row, along with adding multiple data separate rows and columns (leaving a few blank columns in between), it skipped blanked rows and when to the last row that had data. I did the following;

function myFunction() {
var ss =
var lr = ss.getLastRow();
Logger.log(lr);
}

And it somehow gave the last row (skipping blank rows in between).

dwaynedsouza
Автор

Hello Sir, Thank you so much for the great content. I want to create an audit function to pick up random rows based on certain criteria. Could you please provide some help? Thank you!

yasmeenkarachiwala
Автор

Great job, easy to follow guide.. I was just wondering how to do this. Thx

patrickm
Автор

Very nice tutorial, thanks mate.
So I'm trying to create a button, that sets the next checkbox (they are in G11:G and auto timestamp with your onEdit(e) approach in H11:H) right after the last row to TRUE when pressed, so that I have a "LOG IN" button at the top without the need of scrolling down and toggling the respective box myself.
How can I use the "lr" variable to set the value, can you help me on that one maybe?

kachler
Автор

Doesnt work for me, it said "Cant getRange property of undefined.

oxpey
Автор

Why not set lrIndex inside your if statement? Why set it on every iteration of the for loop? You already have i tracking. Just set it when you find what you're looking for. Or am I missing something?

SilverfoxTOAO
Автор

I might encounter a tiny bug. If the last row is 0. Then the every(function(c){ return c == ""; }) would return true instead of false.
But every(function(c){ return c === ""; }) fix it.

emersonpan
Автор

I have a result set that I push in one array and I want to paste it from the last blank row. Do you have any method using appscript to obtain the last blank row and paste all my array from this blank row? I want to paste all array instead of row by row in spreadsheet. Thanks!

securecircle
Автор

quick question: how do you create a script to delete the last row?
similar to this script:

function row() {
var spreadsheet = SpreadsheetApp.getActive();

spreadsheet.getActiveSheet().deleteRows(spreadsheet.getActiveRange().getRow(),
};

ZX-uhmw
Автор

Thanks for sharing. Great content as usual!
Could you give us a light, please? I explain my point bellow.

That <every()> method is witchy... I'm not as much familiar to JS as I should be, I guess...
At 18:30, you take all 5 first columns in a range (rng = "A1:E"), than you feed one line at a time doing 'row = rng[i]'.
Later, you instruct that every cell in that row should run a function that returns a logical result, testing its content against null ("").
So, every cell is going to test equality to 'null' and the variable <isBlank> receives them all, actually as an array containing TRUEs and FALSEs, five of them at most.
Is that right?
In the most common situation, we have 'row=[, , , , ]' -- so we get 'isBlank=[TRUE, TRUE, TRUE, TRUE, TRUE]'
But when 'row=[, , blah, , ] -- we instead get 'isBlank=[TRUE, TRUE, FALSE, TRUE, TRUE]'. Listen, Your code is not ANDing all those cells, even though a simple 'if(!isBlank)' does the magic!! Why is that??!
Dawn, I hate those smoothly typeless languages... Can you provide a documentation where I can read all those implicit routines in JS, please?

strativaryus
Автор

how can i do to send data from one spread sheet to another spread sheet please

jaedonbigbrain
Автор

Hi, can you help me for this : No logs found. Use Logger API to add logs to your project.

Thank you before..

wilbertsembiring