Best answer

How do I prevent Zapier from removing spaces from the spreadsheet-style formula?

  • 4 August 2023
  • 3 replies
  • 46 views

Userlevel 1

Hey community, I have an action that is getting certain records from a zapier table:

 

I then want to perform spreadsheet style operations on one of the outputs (in my example above, I wand to sum the amounts).

If I then use the Zapier formatter > numbers > spreadsheet style formula and the SUM formula and select my Amount outputs from the previous step, it removes the space after the comma preventing the SUM formula from working. Here’s what it looks like:

 

Any ideas on how I can keep the space in there so the formula works?

icon

Best answer by GetUWired 4 August 2023, 22:15

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

Hey @ewager,

It looks like the space is not the issue here.  From what I can tell, the issue is that you are using line items from your previous step.

I would fix this issue with a Code Step by Zapier (Javascript).  I will include a picture below.

 

This would let you add these numbers together.  I’ll also include the code below so you can copy and paste.

Hope this helps!

 

let numbers = inputData.numbers;

numbers = numbers.split(",");

let sum = 0;

for (let i=0; i < numbers.length; i++){

sum = sum + parseFloat(numbers[i]);

}

output = [{sum}];

Userlevel 7
Badge +12

I also think I found a way to do this with your current setup with the spreadsheet formulas.  

Before the sum step, put in a step like this.

Take the text output and place it in your formula.

Userlevel 1

Hey! Thank you very much. That added step worked. Very helpful.