Skip to main content

Hello,

 

Bit of a complicated problem here. I work at an advertising company that manages a lot of campaigns.

The Problem:

We want to know when campaigns go live so we can tell the client. The problem is that it’s a time suck to sit and wait around for a couple hours checking in to see if a campaign is live or not.

How I’ve Started To Solve The Problem:

I get an automated email every hour on the hour. The email contains a standard CSV with all placements and number of impressions each placement has received.

Is there a way for me to have Zapier recognize when the standard CSV (1) adds a new line item, and (2) that line item has more than 100 impressions attached to it? I think digests might accomplish what I’m trying to do but I can’t make it work in my head. Another solution I can think of would involve setting up a Google Sheet where I have one Zap that adds line items to the Google Sheet if they don’t exist already, and sending out a Slack message whenever it adds a line item to that Google Sheet.

Thanks!

Hi @Chris Verrill 

Good question.

Try this logic…

Zap 1

  1. Trigger: Gmail - New Attachment
  2. Action: Formatter > Utilities > Import CSV
    1. NOTE: 500 row limit
  3. Action: Looping
  4. Action: GSheets - Find/Create Row

 

Zap 2

  1. Trigger: GSheet - New Row
  2. Action: Filter
    1. # of Imps > X
  3. Action: Slack - Send Channel Message

@Troy Tessalone Thanks a ton for your help! One question:

 

Can you elaborate what the “Looping” step should do? How do I prevent placements from being added to the GSheet that have already been added? Do I need a filter between steps 3 and 4 in Zap 1?


@Chris Verrill 

Help article about the Looping app: https://zapier.com/apps/looping/help

Looping would iterate thru each or of the CSV file to then find the matching row, else create the new row.

You can follow that with an update row action if you want to update existing rows.


Hi @Chris Verrill! Were you able to get it working using Looping by Zapier as Troy suggested?

Want to make sure you’re all set here! 🙂 


Yes! For anyone in the future with a similar problem who finds their way here, my solution looks similar to Troy’s:

  • Trigger: New Attachment in Gmail looking at a specific label--I set up a filter in my inbox to direct all reports to that label.
  • Formatter utilities -- to import .csv with type “text”
  • Code to remove first 8 lines of .csv (code below)
  • Formatter utilities -- to import .csv with type “default” from the Code step
  • Loop values to loop: all fields in .csv
    • filter: only continue if impressions is greater than 100
    • lookup spreadsheet rows by lookup value “placement”
    • filter: only continue if “Zap Search Found Status” exactly matches “false”
    • create spreadsheet row in Google Sheet

And then a zap looking at the Google Sheet and sending a Slack message any time a new spreadsheet is loaded.

 

Here’s the code--found a bunch of people looking for something similar on this forum but couldn’t find the code itself. For code newbies--it’s in Javascript. Again, this is code that will remove the first row of a spreadsheet in Zapier. (Actually, here it removes 8 rows. If you want to only remove 1 row, change “i > 7” to “i !== 0”.)

var csv = inputData.attachment;var newCsv = v];var lines = csv.split("\n");lines.forEach(function(item, i) {  if(i > 7) newCsv.push(item);}) newCsv = newCsv.join("\n");console.log(newCsv);return {newCsv};