Skip to main content

I want to send a csv every day in an email. I have the csv data as a string field from a private API and I cannot make the API public.

 

Gmail takes in a file object. 

So, how does one take that string into a file object and give it a name which gmail can attach?

Hi @TylerFromReceive 

Can you provide more details and a specific example to better clarify for us?

Screenshots are helpful for context.


Hi, so i have zap which is:

  • every day at 2pm UTC 
  • grab a list of users
  • do a for loop for each user:
    • run custom code which downloads a csv file from https://example.com/csv?k1=v1&k2=v2 and puts it as an output variable since it’s a string.  it uses headers for authorization which is why I can’t put the public URL in the gmail section.
    • Send an email via gmail to the user with the csv as an attachment

My problem is that gmail requires a “file object” (or a public URL which I don’t have). I cannot figure out how to turn my csv text into a “file object” that gmail can attach. I don’t want to upload the csv publicly and then attach as that’s messy.

What i’d like is a very simple utility which given a filename and file content, both as strings, creates a file object for usage in later parts of zapier


@TylerFromReceive 

You can try using a Code step to create a CSV file.

https://zapier.com/apps/code/help

Maybe ask ChatGPT for help with the code.

 

You can search Zap apps here: https://zapier.com/apps

Perhaps try EasyCSV: https://zapier.com/apps/easycsv/integrations#triggers-and-actions

 

Another option would be to try this Zap action: GDrive - Create File from Text

 


> You can try using a Code step to create a CSV file.

I asked the chatbot AI how to do it, and it did what I did which was output it as text. We also both tried using stringIO, but got back an error “We were unable to place a file in a text field or possibly the otherway around.” It did not help me output a value that’s type is “file object”

> Perhaps try EasyCSV: https://zapier.com/apps/easycsv/integrations#triggers-and-actions

I tried easyCSV but it creates a temp file, which is messy.


gdrive also creates a temp file, which I want to avoid.


@TylerFromReceive 

Maybe try this private invite only Zap app: Advanced Utilities which has a toCSV option.

 


Thank you, this is closer and does offer the output file option, but it only takes in json and my data is raw csv text, ex: “A,B,C\nD,E,F”.


@TylerFromReceive 

You could use a Code step to convert the raw CSV text into JSON.

ChatGPT should be able to help with that.


While I could, this is still messier than I’d like. csv → json → csv. 

Is there no private zap app where you pass in two strings and get back a file object?


So I tried to make an app but nowhere does it say I can output a file: 

How do I output a file object?


@TylerFromReceive 

Zapier Developer Platform help articles that may provide guidance: https://platform.zapier.com/search?q=files


https://platform.zapier.com/reference/cli-docs

This is the only instance I can find of the phrase “file object” anywhere in the docs. Is there example code on how to make a file object? 

 


@TylerFromReceive 

You may be better served by trying to open a ticket with Zapier Support to ask about possible guidance for the solution you seek: https://zapier.com/app/get-help


I have an open ticket, they haven’t gotten back to me yet