Python script in Zapier only uploads first file to Dropbox instead of all files

I’m having trouble with a Zapier workflow where I need to upload several files to Dropbox. My Python step creates a list with file details, but when Dropbox processes it, only one file gets uploaded instead of all of them.

My Python code (Step 2):

documents = [
  {'filename': 'report_alpha.pdf', 'download_link': 'https://example.storage.com/doc1'}, 
  {'filename': 'report_beta.pdf', 'download_link': 'https://example.storage.com/doc2'}
]

return documents

Dropbox step (Step 3):
I’m mapping the filename and download_link fields from the Python output.

What am I doing wrong? Should Zapier automatically process each item in the list? I expected both files to be uploaded but it’s not working as planned.

The issue arises from how Zapier interprets arrays. When your Python code returns a list, Zapier treats it as a single entity rather than processing each item separately. I faced a similar problem during a document automating task. One solution is to adjust your Python code to return each document as separate variables like document_1, document_2, etc., followed by creating individual Dropbox steps. Alternatively, you could implement the looping feature as suggested, but keep in mind that it requires a paid subscription, as the free plan does not support the Looping tool.

Zapier’s behavior with list outputs can be tricky, as it processes only the first element in a Python-returned list of dictionaries. I’ve encountered a similar issue while automating a project. A solid approach is to modify your Python code to return each file as separate fields, like filename_1, download_link_1, and so on. This way, you can create distinct Dropbox steps for each file. If your workflow might vary in the number of files, consider using webhooks for triggering separate workflows to manage uploads individually, though it requires more initial setup.

had this same issue b4. you gotta add a ‘looping by zapier’ step, yeah? that way it goes through each file in your list one by one. otherwise, it just takes the first one. give it a shot!