Run workflow once for each file

Hello everyone. This is my first post, still being pretty new to Retool and coding in general.

I have a file drop component, where i can currently add one file, run a workflow, and get a file out.

But i would like to be able to drop multiple files, and then get the workflow to run once for each file. Would that be possible? And if so, how?
image

Thanks in advance for any input.

I figured it out. I just used a lot of "if" blocks in my workflow. and duplicated my codeblock. If there was more then one file, it would just run each file through its own code block.
I'm sure there is a better way, but it worked.

1 Like

Welcome to Retool, @SebastianDK :slight_smile:

1 Like

Thanks :slight_smile:

Glad you found a solution. Here's how I would approach the problem.

You already made a workflow to process one file right? Make a second workflow that is the "runner" of the first one. The second workflow accepts multiple files, and runs a loop block that calls the first workflow to process the file.

This will keep your logic clean for the one file, and a separate process for multiple.

1 Like

Thanks for the feedback. Ill try and do something similar.