Skip to main content
Question

Creating a loop through multiple upload fields


Hi all, I am dealing with a problem in Zapier.

 

I am using the Gravity Forms addon in zapier, connected it to dropbox and looping by zapier.

The problem that I am having is that the Gravity form has multiple upload fields.

The path is as follows. Using the gravity form addom > creating a folder based on the projectname > looping through the files uploaded > upload them in the folder.

 

The problem is that I can make the looping happen only on one of the file upload fields. Even though I put all fields in them, I can't make it work to loop through all fields.

 

Looper:

 

Upload dropbox, can only choose one upload field

 

 

Did this topic help you find an answer to your question?

9 replies

Troy Tessalone
Forum|alt.badge.img+14

Hi ​@Hilversum.media 

Here are some options:

  1. Use a Code step to combine the upload fields into a single array list of files that you can pass thur the Looping step
  2. Use a Sub-Zap for each of the file fields that will handle the Looping
    1. Help: https://help.zapier.com/hc/en-us/articles/8496308527629-Build-reusable-Sub-Zaps
  3. Send (via a Webhook) the data for each file field to another Zap that will handle the Looping
    1. Webhooks: https://zapier.com/apps/webhook/help

Hi ​@Troy Tessalone

Sorry I am not that good yet using zapier.

I made the code step now using the following code:

def zapier_code_step(input_data):

    # Extract the file fields from input data

    files = [

        input_data.get("file1"),

        input_data.get("file2"),

        input_data.get("file3"),

        input_data.get("file4"),

        input_data.get("file5"),

    ]

   

    # Filter out any empty values (if some files are missing)

    combined_array = [file for file in files if file]

   

    return {"combined_files": combined_array}

 

After that you told me I needed to use a Sub-Zap. I guess I need to place the Sub-Zap after the Code step. I can only choose for call a Sub-Zap and Return From a Sub-Zap from there.

 

After that you told me to use a webhook to send it to another zap.

 

So as I am reading it now.

 

Gravity forms step

Code by Zapier

Subzap (I am stuck in this step) How do I define the fields in the Sub-Zap.

Send it to another zap with a webhook

 

fyi. I now have something like this:

 

Thank you so much in advance.

 

 


Troy Tessalone
Forum|alt.badge.img+14

@Hilversum.media 

The 3 options I provided do not have to be used together.

If you are using Code, then send the output of the Code thru the Looping step.

Then map the output of the Looping step to the action steps after the Looping step.


Again sorry. For what i understand I can now use the python code step in the looping? 

After that use that to upload all files to dropbox.


@Troy Tessalone I now got all fields:

# Extract the file fields from input data
files = [
    input_data.get("file1"),
    input_data.get("file2"),
    input_data.get("file3"),
    input_data.get("file4"),
    input_data.get("file5"),
    input_data.get("file6"),
    input_data.get("file7"),
    input_data.get("file8"),    input_data.get("file9"),    input_data.get("file10"),

]

# Filter out any empty values (if some files are missing)
combined_array = [file for file in files if file]

# Return the combined files in the expected output shape
output = {"combined_files": combined_array}

 

I used the loop as follows:
 

 

I upload 2 files and I can see the the loop step sees 2 steps:
 

 

Dropbox upload:
 

 


Troy Tessalone
Forum|alt.badge.img+14

@Hilversum.media 

Help link for using Looping in Zaps: https://zapier.com/apps/looping/help

Map the variables from the Looping step to the Dropbox step that comes after the Looping step.

 

When in doubt, test it out.

 

  • When you test this action, the Zap will only create the first loop. 
    • It will not create any other loops during the test.

@Troy Tessalone 

Thanks i am gonna look onto it.

 

I am getting this error now:
 

Hope I will find the problem haha


Troy Tessalone
Forum|alt.badge.img+14

@Hilversum.media 

For us to have info about the encountered error, post screenshot showing how your Zap step is configured in EDIT mode with the field mappings visible.


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6285 replies
  • February 6, 2025

Hi ​@Hilversum.media,

Just giving a quick nudge here to share the updated configuration of your Dropbox step so that we can take a closer look at the error that you’re encountering.

Thanks!