Search code examples
google-sheetsselectcountlimitgoogle-query-language

Google sheet Query - Exclude the very last row


I'm trying to write a query function that takes data in sheet A to sheet B, but I'm going to exclude the last row of data. Is there a way to do this filter?


Solution

  • =QUERY(A:C, "limit "&(COUNTA(QUERY(QUERY(A:C, "select *"), "select Col1"))-1))
    

    0

    or in other words, if you know that whole query is 4 rows do:

    =QUERY(A:C, "limit 3")