How to get the last raw of a google sheet node?

i created a google sheet node and i want to get the value of the last raw in the table?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @imane_mottaqi

If you use the Google Sheets (Get Rows) Node you should see the Row Numbers as part of the output. You could then get the last row number by using a code node, for example:

const lastRowNumber = $input.all().reduce((maxRow, item) => {
  const rowNumber = item?.json?.row_number;
  return rowNumber > maxRow ? rowNumber : maxRow;
}, 0);

return { lastRowNumber };

Let us know if this helps! :raised_hands:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.