Handling error within loop from google sheets

Describe the problem/error/question

I have a google sheet with thousands of rows of data and a dozen columns.
i want to parse some columns through a series of checks and if it errors out during any of these, then i want certain data from the original sheet written to a log (google sheet) along with an error then go to the next row in the original list. If there are no errors in the parsing process, then it will write similar to the log sheet, but instead of an error it will have the output i am looking for.

am i overthinking the process?
anytime i had an error i would add a node to separate out the specific item causing the issue and make it log, then loop to the next one

I had to cut out a dozen steps of error logging to fit the project within this post, but they follow the same process of going to the wait, then writing to the sheet before returning to the loop

What is the error message (if any)?

for my last google sheet save i get “cannot determine which item to use” for the fields… sometimes. sometimes it works.
my guess is the logging and looping back around may be causing the issue, but it will just stop on errors without the return loop

to clarify:
on error it writes all the data just fine (except the AI portion)

without any error (until writing to the spreadsheet at the end of the loop) it misses all the original fields that are not relating to the AI portion. it basically forgets which row it is pulling data from and doesn’t return all the expected column data.

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

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

I am not sure it’s the workflow or it has the typo

You are using Edit Fields node

But there is no node calling the name. The most similar one is Edit Fields1 node.

That make huge different.

Maybe try to rename the Edit Fields1 to Edit Fields ?!

no sorry, that’s not it.. when trying to shrink this down to fit on the page i cut that out with another big chunk of it, then re-added it and the 1 was added at that time.

i was able to convert a portion of this to a sub flow with the new ‘right-click → create subflow’ so now i can show the way i have the error logging setup

That change actually seemed to resolve the issue. it still does the same flow, but now calling a subworkflow for the AI stuff.
My guess is the workflow was too long and something getting lost in memory?

1 Like

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