Pulling .csv Attachments from New Email Triggers

Hello,

I am using “new emails” as a trigger when receiving emails with a .csv attachment. I would like to know how to use a Python step to access and work with that .csv. (I see there is an outdated way to do this with node.js V1, but I do not know this language and would like to work with Python)

So far I have,

import pandas
import requests

def handler(pd: “pipedream”):
data = pandas.read_csv(pd.steps[“trigger”][“event”][“attachments”])
print(data)

But there does not seem to be a .csv file anywhere to give a correct file path to…

In pd.steps[“trigger”][“event”][“attachments”][0][“content”]) I am able to find the content of the .csv file. But it is in a format that has lost a lot of the important formatting of the csv.

In worst case, I’m hoping someone can show me how to use node.js to read this .csv into the /tmp folder in one step that I can then pull from using Python, because I do not understand how to pass data through multiple steps of node.js as seen in the outdated V1 version of “Upload email attachments to S3”.

Thanks!
Donny

Hello @301magicemail,

First off, welcome to Pipedream! Happy to have you!

I think you don’t need to use Node.js code step to download the file to the /tmp dir, as Pipedream provides a Download File to tmp dir helper action for that. To add that action, you can simply search for Helper Functions and select Download File to tmp dir


Then on that action, simple put in the contentURL and the fileName of your attachment. This is my sample workflow:

This solves the problem. Thank you so much!

1 Like