Google Script appendRow() not working when entire sheet is filtered

Skip to first unread message

Gilberto Junior

May 9, 2024, 11:24:52 AMMay 9
to Google Apps Script Community

I found a problem using appendRow method of google scripts when the entire sheet has filters enabled, as described in

The steps to replicate the problem are:

  1. Enable a sheet with the filter enabled in all columns, not only where there's data, like this image.

  2. Filter the column code only with "DSPACE". Note that with all columns filtered, appeared a "Blank spaces" option in the filter; The data vanishes only when trying to insert a row with the filtered value applied.

Now, run the code below:

function myFunction2() {

sheet.appendRow([new Date(), 'DSPACE', 'TEST 4']);
sheet.appendRow([new Date(), 'DSPACE', 'TEST 5']);
sheet.appendRow([new Date(), 'DSPACE', 'TEST 6']);


If the range is not filtered, filtered with "Blank spaces" or the filter is available only to the correct columns, the rows are appended correctly.

Otherwise, the data simply vanish, with no errors, and no row is appended.

Am I missing something?


May 9, 2024, 9:10:54 PMMay 9
to Google Apps Script Community
In your situation, is this thread usful?

Gilberto Junior

May 10, 2024, 6:17:27 PMMay 10
Great help! It works as expected.

Have already seen similar questions, and I was trying to avoid getLastRow() + setValues() because of the atomicity of the insertion. The function will be running in a web app. 
It seems that this is the only solution available for now.


On Thu, May 9, 2024 at 10:11 PM Tanaike <> wrote:
In your situation, is this thread usful?

You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit


May 10, 2024, 8:26:01 PMMay 10
to Google Apps Script Community
Thank you for replying. As I mentioned in my answer to your question on Stackoverflow, when the date object is included in the values, even when that workaround is used, it seems that only the date objects are not put. So, I proposed another workaround. Please confirm my answer.

Reply all
Reply to author
0 new messages