Best answer

Adding Values together in Zapier Storage

  • 18 July 2022
  • 3 replies
  • 950 views

Userlevel 1

Hi,

I’m storing values in a Zapier Storage as a list. 

Is there a way to add all these values together? Struggling to work this one out. 

icon

Best answer by Danvers 18 July 2022, 12:08

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +12

Hi @AshleyB!

Do you meant that you’d like to add them together mathematically (ie they are numbers and you want to add them together)? To answer this I’m going to have to make a couple of assumptions, I hope that’s ok. If I have anything wrong, just let me know!

You mentioned that you’re storing values as a list, so I’m assuming that you’re using the action Storage by Zapier action Push Value onto list. 

 

Based on that, here’s how you can get the items off the list and add them together. 

First, add a Storage by Zapier Get List Values action to the Zap. Set it up so that it’s getting the values from your list and that the item format is %s,

That means that when this action runs, the output will be all of the items in the list with a comma after each item (eg 34, 22, 904,)

 

Next you’ll need a Formatter by Zapier action. Choose ‘Numbers’ for the event and ‘Spreadsheet style formula’ for the Transform. This action allows you to create the type of formula that you’d use in a spreadsheet (eg Excel or Google Docs). In the Formula box, type in =sum( then add the output of from the Storage step, followed by )

 

When this action is run, it will add all of the values in the list together. 

 

One really important thing to remember is that if you’re using Storage by Zapier, getting the items from the list wont remove them from the list - they will stay on there until you use an action to clear all of the values at a particular Storage key. If you’re looking to add items to a list and then remove them all regularly, you might be better off using Digest by Zapier. It is similar to Storage but is a bit simpler, it doesn’t allow for things like line items for example. If you’re using Digest, the process will be a little different but similar. Instead of adding the comma between the items when fetch the items, you add it as the items are going into the digest. For example, if you add the number 45 to the Digest you type a comma afterwards the number so it becomes 45,. That way, when you get the Digest (which will clear all values from it) your output will be each number followed by a comma. 

 

I hope that answers your question - let us know if you need any other help!

Userlevel 1

Hi @AshleyB!

Do you meant that you’d like to add them together mathematically (ie they are numbers and you want to add them together)? To answer this I’m going to have to make a couple of assumptions, I hope that’s ok. If I have anything wrong, just let me know!

You mentioned that you’re storing values as a list, so I’m assuming that you’re using the action Storage by Zapier action Push Value onto list. 

 

Based on that, here’s how you can get the items off the list and add them together. 

First, add a Storage by Zapier Get List Values action to the Zap. Set it up so that it’s getting the values from your list and that the item format is %s,

That means that when this action runs, the output will be all of the items in the list with a comma after each item (eg 34, 22, 904,)

 

Next you’ll need a Formatter by Zapier action. Choose ‘Numbers’ for the event and ‘Spreadsheet style formula’ for the Transform. This action allows you to create the type of formula that you’d use in a spreadsheet (eg Excel or Google Docs). In the Formula box, type in =sum( then add the output of from the Storage step, followed by )

 

When this action is run, it will add all of the values in the list together. 

 

One really important thing to remember is that if you’re using Storage by Zapier, getting the items from the list wont remove them from the list - they will stay on there until you use an action to clear all of the values at a particular Storage key. If you’re looking to add items to a list and then remove them all regularly, you might be better off using Digest by Zapier. It is similar to Storage but is a bit simpler, it doesn’t allow for things like line items for example. If you’re using Digest, the process will be a little different but similar. Instead of adding the comma between the items when fetch the items, you add it as the items are going into the digest. For example, if you add the number 45 to the Digest you type a comma afterwards the number so it becomes 45,. That way, when you get the Digest (which will clear all values from it) your output will be each number followed by a comma. 

 

I hope that answers your question - let us know if you need any other help!

Thank you will check this out. 

I may need to open another thread. But do you have a solution to this.

I have a Google spreadsheet with rows of values and a date field. Is there a way to only add values from the row to a storage or digest based on them being within a date range e.g (last 5 days from today)?

 

Then if the values are more than 5 days from today remove them from storage?

 

Hope this makes sense

Thanks

Userlevel 7
Badge +12

Hi @AshleyB!

I can see that you’ve started a new thread an have a reply there, so I’m going to close this one and mark my previous reply as an answer to your first question, I hope that’s ok. 

If anyone would like to follow along with the second thread, which asks the question: how do you only sum the last x days and then remove the data? That post is here: