Filtering data

How can I filter some values in a google sheet to be greater than 20%? This can’t be done in the filter node as ‘number’ doesn’t support ‘%’.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@Maisha_V , what values do you get from the spreadsheet - numbers representing percentage (for example, 30 meaning 30%, OR 0.3 meaning 30%) or percentage (for example, “30%” as a string). I am asking because you can format your Google Sheet in all those 3 ways.

Thus, the answer could be fixing your Google Sheet formatting and/or the formula in n8n.

Since you are mentioning “number”, then what you have is likely either 20 or 0.2. Depending on which one, you need to utilize either “number > 20” or “number > 0.2” to check if the number is greater than 20%.

Perhaps the number from spreadsheet does not represent percentage at all and you need to compare to some completely different total value? Please, provide more clarity if neither of my suggestions work for you.

@ihortom , in google sheets, there is a specific column named ‘ACOS’ that contains percentages like ‘30%’ and i want to filter it to be greater than 20%

@Maisha_V , in that case, for the sake of this task, you can configure Google Sheet node to ignore spreadsheet formatting and get pure numbers instead. Then you would use a simple formula “number > 0.2”.

If you still want to keep spreadsheet formatting, which means pulling strings with “%” rather than numbers, then you would have to strip “%” and convert the remaining string to number. For example, {{ parseFloat($json.ACOS.slice(0,-1)) }} will give you the floating number, that is the number from the spreadsheet but without “%” which could be used in the formula “number > 20”.