I have an email trigger and that should get emails with attachment (csv). When the trigger occurs python code is just getting that file attachment and reformats some of the field, basically getting through the data cleaning process.
After that next zap should get the file output (Buffer or text - tried both ways) from Python code output and uploads that parsed file to the Dropbox.
The problem is that zapier outputs from Python code looks like this : `hydrate|||.yQzjsNAVgmULBE-y68eopBMoP0_XD1LL9VxsnE1uSTJi5NwHN-rkDzYP85WMi1Gf|||hydrate`
Page 1 / 1
Hi
Can’t you map the output python file to Dropbox upload file action?
Nope, if I remove Python Code from zap and connect direcly Trigger with the Dropbox upload file action the file is uploaded to properly.
Here is snipped of Python code
import csv
import io
# attachment is the file from Dropbox
file_buff = io.StringIO(input_data.get('attachment'))
csv_data = csv.DictReader(file_buff)
csv_lines = ]
for l in csv_data:
### parse data here in loop
csv_lines.append(l)
parsed_csv = io.StringIO()
csv_writer = csv.DictWriter(parsed_csv, csv_data.fieldnames)
csv_writer.writeheader()
csv_writer.writerows(csv_lines)
# move file ptr into beginning and read as string
parsed_csv.seek(0)
data = parsed_csv.read()
# data - is a string
output = {'parsed_csv': data, 'fieldnames': csv_data.fieldnames}
parsed_csv.close()
I have mapped `parsed_csv` to the Dropbox. When Zap runs outcome in Dropbox file is not csv, rather it contains string : `hydrate|| ………..`
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.