Google Reader do next loop iteration if tab does not exist

Hello KNIME community - I’m looking to learn about skipping loop execution.

I am reading a “parent” google sheet and extracting a “child” google sheet ID that is in each row. I pass the child google sheet ID as a variable into another Google Reader node. I want to read the “ABC” tab, if it exists, on every child sheet passed in.

However, not all child sheets have an “ABC” tab, and this is stopping further execution. I’d like to just go on to the next child link from the parent sheet. Please help with ideas to get around this.

Here is a diagram of my workflow.

The error, as expected, is

ERROR Google Sheets Reader 8:329      Execute failed: Could not fetch sheet name for given spreadsheet id: 400 Bad Request
{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Unable to parse range: ABC",
    "reason" : "badRequest"
  } ],
  "message" : "Unable to parse range: ABC",
  "status" : "INVALID_ARGUMENT"
}

I’ve tried to think of solutions using GET requests, try/catch, or IF nodes but can’t get something that works.
Thanks in advance for any help!

Hi @abiasella,

You can make use of Error Handling nodes in KNIME to prevent workflow failure.
Here, you can put Google sheet reader inside a try-catch construct and pass an empty table in case of failure. You just need to let the Loop End allow different table specifications in each iteration or make sure that you pass the same table structure instead of an empty table.

1 Like

@abiasella maybe you can adapt this example. The collection is done in a temporary database so you would not need to provide a dummy table

You might have to provide an empty table at the catch part of you want to collect tables directly.

You could also check the additional links here:

2 Likes

Perfect, thank you. The Python problem link was the most helpful. Here is my final working example using the try/catch nodes.

3 Likes

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