I'm trying to achieve this kind of thing :
\newcommand{\test}[2]{#1 & :={#2} € & :={[-2,0] * [-1,0]} € \\}
\begin{spreadtab}{{tabularx}{\textwidth}{|X|r|r|}}
@ Col 1 & @ Col 2 & @ Col 3 \\
\hline
\test{2}{50}
\test{3}{100}
\hline
\multicolumn{2}{|r|}{@ Total} & :={sum(c2:[0,-1])} € \\
\end{spreadtab}
This doesn't work and shows me formulas instead of result.
I understand formulas aren't processed because they are in the command, but I didn't found how to resolve it.
----- edited 5 month later -----
The accepted answer is a pretty good answer to the question I was asking, but after some time unable to really getting what I wanted, I let it go and came back later when I had time, with another technique, not using spreadtab at all (it's a good module, but not adapted to my case).
For those reading this question, there is my solution :
\newcounter{total}
\setcounter{total}{0}
\newcommand{\test}[2]{
\addtocounter{total}{\fpeval{#1 * #2}}
#1 & #2 € & {\fpeval{#1 * #2} €} \\
}
\begin{tabularx}{\textwidth}{|X|r|r|}
Col 1 & Col 2 & Col 3 \\
\hline
\test{2}{50}
\test{3}{100}
\hline
\multicolumn{2}{|r|}{Total} & \the\numexpr\value{total} € \\
\end{tabularx}
This is a longer solution than what I wanted, with "manual" formulas, but this works well.
spreadtabpackage? – Skillmon Sep 25 '19 at 13:33