When the values returned by google sheets are reassembled, the second line and further do not see the values of a certain node

Describe the issue/error/question

I catch a trigger message from the telegram bot, then I go through all the users from my google spreadsheet. I want to check for the presence of a user who wrote a message to the bot in google tables. But when I start going through the values obtained from the Google table, I see that for 2 and higher chat_id values from the telegram node just disappeared! I checked this by sending myself messages in the bot.

Please share the workflow

This is what sending to the bot looks like

Expression

Google Sheet data
image

Bot Message
image

The screenshot shows that starting from the second line, the chat_id was not passed.

Share the output returned by the last node

Information on your n8n setup

  • n8n version: Last
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]: default
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hi @Hypecoder, welcome to the community!

So the problem here would most likely be the mismatch in item numbers between your Telegram Trigger and Google Sheets.

Your final Telegram node would run for each item it receives from the previous Google Sheets node. For the first item it would then look up the first item from your Telegram Trigger which works fine from the sounds of it. For the second Google Sheets item it would look up the second item from your Telegram Trigger which doesn’t exist.

So what you want to do is always pick the first (and only) item from your Telegram Trigger, correct?

If so, you can simply put an $item(0) in front of your expression, so something like {{ $item(0).$node["Telegram Trigger"].json["message"]["chat"]["id"] }}.

Hope this helps!

Hello! It really helped solve my problem. I really didn’t think that starting from the 2nd entry, the entry would start asking for an index-like entry from the telegram node. But your answer solved my problem. I also carefully examined the google sheets node and found there the ability to filter data by parameter, which gave me the opportunity to upload 1 record at a time. Thank you very much!

1 Like

Excellent, glad to hear this worked despite the typo in my last message :smiley: