How to add error variable, if an error occurs do action A if no errors occur do action B

Friends, I’m trying to merge several different databases of different files into one, and I was successful with this flow. But a problem arose, in some files the desired tab appears and in others it doesn’t, so the flow stopped working. Basically, if in one of the files being consolidated there is no tab “X”, do nothing and move on to the next path. Can you help me?

The flow is too long to send here, but basically this is where the error occurs since it doesn’t find a tab in one of the files.

Hello @max_kretschmann
It results ambiguous when you mention about databases; if the case is an excel repository in a failing server request, you can test the ‘Try - Catch Errors’ family nodes…

However if the problem is just about file structure; I think that you could use a ‘Read Excel Sheet Names’ aiming to classify your Path files. And filter the ones holding the target tab…

BR

PS.- A ‘Case Switch’ or ‘IF Switch’ node instead of filtering, it can help you to give a different processes for A or B case.

4 Likes

A quick and dirty solution would be to adjust the settings of the loop end node:

Activate “allow variable column types” and “Allow changing table spec…”

You will end up with a table where all columns of each excel file are kept.

1 Like

Sorry, I’ll explain better.

I have several Excel files, some of them have a tab called “Spec” and some don’t.

I’m consolidating all these files through a loop, but since the Excel reader doesn’t find the tab in one of the files, the flow doesn’t work.

Please help me and excuse my English, I’m using the translator.

My Flow:

Ah, I mixed up something.
You mentioned “tab” and I thought “Columns”…

So you have multiple Excel Files with a structure similar but not equal. From all Files you want to read the tab “Spec”.

You can use the “Read Excel Sheet Names” Node for example.
Read in the sheets then filter according to your needed sheet name “Spec”. If it is found, read in the excel file.
If not → pass to the end node and start the next iteration

3 Likes

this worked, thank you very much!

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