# Table built with if else statement

I'm trying to build a table that will have a table that will automatically assign a third column depending on the grade. So, the third table is dependant on the second one. I want it to look something like this without the letter actually being in the excel sheet. Thank you!! The latex code is what I have so far, but it doesn't work.

\documentclass{article}

%Packages
\usepackage{csvsimple}
\usepackage{datatool,filecontents,tabularx,booktabs}

\begin{filecontents*}{test.csv}

Hans,m,1

Anna,f,2

Anton,m,5

Hilde,f,5

\end{filecontents*}

\begin{document}

\begin{table}
\centering

\caption{trying for assigning grade}

table head= \hline Name & grade & letter \\ \hline,

late after line= \\,

table foot= \hline,

]

{

{\name & \grade & A}

\else

{\name & \grade & C}

\fi}

\end{table}

\end{document}


The problem was the incorrect syntax for the conditional. I took the opportunity to improve the table with the rules of booktabs and caption, for a decent spacing between caption and table:

\documentclass{article}
%Packages
\usepackage{csvsimple}
\usepackage{datatool,filecontents,tabularx,booktabs, caption}
\begin{filecontents*}{test.csv}
Hans,m,1
Anna,f,2
Anton,m,5
Hilde,f,5
\end{filecontents*}

\begin{document}

\begin{table}
\centering\setlength\extrarowheight{2pt}
\caption{trying for assigning grade}
table head= \toprule Name & grade & letter \\ \midrule,
late after line= \\,
table foot= \bottomrule,
]