I’m trying to set a Google Sheets formula through the Set Node, but the equal sign (=) does not go through the node, I type the formula inside the node, but when I close it, it disappears and doesn’t set the proper value. The value remains exactly the same, but without the equal sign (=), I believe it is a bug, but it could very much be me doing something wrong
What is the error message (if any)?
The error appears a couple of nodes later when I read the output of the cell where the formula should be, as it does not parse it as such. The error arises in a notion node where I upload the result of the formula, but the field expects a number (not text)
Workflow
This is what it displays when opening the node or when I close it and open it again after adding the =
Only works if I manually put the equal sign before running the node
So far, I’ve tested with the “keep only set” on and off, with and without the expression, I’ve tried running the same node on a new instance of n8n built specifically for this test, I’ve created new nodes and workflows to try this, and don’t know what else to try.
Maybe someone has an alternative solution for now?
Thanks
Information on your n8n setup
n8n version: 0.208.1
Database you’re using: SQLite
Running n8n via: Docker on Digital Ocean Instance, and tried on a local instance too.
Hi @seba5496, I believe this could be a problem with n8n using the = character on the first to identify expressions (over plain text). You can see this when looking at the JSON representation of a workflow, like you did by copying your data into VS code.
I understand how annoying this is, but I don’t have a great workaround ready for such situations . Perhaps you can simply read the value coming from your Google Sheet and manually append an additional equal sign to the first position, by using an expression of =INDICE(GOOGLEFINANCE(\"USDCLP\"; \"close\"; \"{{ $json["Fecha_Original"] }}\";;\"DAILY\"); 2;2)?
This would keep the original value with the single = character:
Hey @MutedJam sorry for my late response, I tried the proposed solution, but at least for me, it didn’t work, after adding the second = and closing the node to save, and check again the node, both = would just disappear.
However, I found two workarounds so far, First, I added the formula, to a Notion formula and read that column inside the set node. And the second, is to generate the needed formula inside a Code Node with js.
I prefer the later one, I’ll leave the code in case someone finds themselves in the same situation.
So the code would look like this: Code Node with Run once for each item:
$json.ValorCalculadoDia = $json.ValorBaseDeterminado
$json.CalculadoSoloArriendo = "=S" + $json["keynum"] + "*N" + $json["keynum"] //ValorBaseDeterminado * N° de días (S$*N$) $= Numero
$json.Total = "=T" + $json["keynum"]+ "+O" + $json["keynum"] //Calculado solo arriendo + ServiciosAdicionales (T$+O$) $ = Numero
$json.Comision = "=T" + $json["keynum"] + "*R" + $json["keynum"] // Calculado solo arriendo * Comision_p (T$*R$) $ = Numero
$json.MonthID = "=CONCATENAR(E" + $json["keynum"] + ';" "; F' + $json["keynum"] + ")" // Concatenar Mes + Año (concat(E$;" ";F$)) $ = Numero
return $input.item;
Sorry if it is a bit messy, haha. I don’t have a lot of experience in JavaScript.
I haven’t tried to reproduce the old issue, but I find the current workarounds work just fine, haha.
Thanks