I use csvsimpl-l3 and tabularray packages to create tables from a CSV file. In the CSV file, some data are marked with "significant". The sign "|" pipe is used to separate data from the word "significant". Data modified in this way should be formatted differently in the output table compared to other data. Namely, the cell of the table should have a gray background, the data should be bold and colored in red. Of course, the output table should not show "significant|".
My example gives a partially good result because the \SetCell command does not work at all and does not format the table cell correctly.
I note that it is important for me to keep the use of the package csvsimple=l3 and tabulararray, as well as the command \SetCell.
If anyone knows how to solve this problem and can help, it would be of great help to me.
\documentclass{article}
\begin{filecontents}{test.csv}
significant|a,b,c
1,significant|2,3
4,5,significant|6
\end{filecontents}
\usepackage{csvsimple-l3}
\usepackage{tabularray}
\usepackage{xcolor}
\usepackage{xstring}
\NewDocumentCommand{\applystyle}{m}{%
\IfSubStr{#1}{|}{%
\expandafter\SetCell{fg=black!10,bg=red}\bfseries\applystylehelper#1\relax
}{%
\strut#1%
}%
}
\def\applystylehelper#1|#2\relax{%
\helperstyle{#1}{#2}%
}
\NewDocumentCommand{\helperstyle}{mm}{%
\IfStrEq{#1}{significant}{%
{\strut}#2%
}{%
\strut#2%
}%
}
\begin{document}
\csvreader[
no head,
generic collected table = longtblr,
generic table options = {[label = none]{
rowhead = 1,
colspec = {|X[1,c]|X[1,c]|X[1,c]|},
width=0.5\textwidth
}},
table head = \hline,
late after line = \\hline
]{test.csv}{}{%
\applystyle{\csvcoli} & \applystyle{\csvcolii} & \applystyle{\csvcoliii}%
}%
\end{document}


