add tag
CarLaTeX
This simple example works:

```
\begin{filecontents*}{example.csv}
A
{51,502}
{121,151}
\end{filecontents*}
\documentclass{article}
\usepackage{tabularray}
\usepackage{csvsimple-l3}
\begin{document}
    \csvreader[
        head=true,
        tabularray = {
            width=\linewidth,
            colspec={r},
            },
        table head = {First\\},
        ]
        {example.csv}
        {}
        {\csvlinetotablerow}
\end{document}
```
![image.png](/image?hash=abcc1ffe243a6cbdb08624dbd2720e7fe439da1ad483468fecfb3ebbb3930f83)

In case my `csv` has `"..."` around the numbers with comma as decimal point, in the [`csvsimple-l3` manual](https://ctan.mirror.garr.it/mirrors/ctan/macros/latex/contrib/csvsimple/csvsimple-l3.pdf) there is an hook to trasform `"..."` into `{...}`.    
But it does not work:

```
\begin{filecontents*}{example.csv}
A
"51,502"
"121,151"
\end{filecontents*}
\documentclass{article}
\usepackage{tabularray}
\usepackage{csvsimple-l3}
\AddToHook{csvsimple/csvline}
    {
        \tl_set_eq:NN \l_tmpa_tl \csvline
        \regex_replace_all:nnN { "([^"]+)" } { {\1} } \l_tmpa_tl
        \tl_gset_eq:NN \csvline \l_tmpa_tl
    }
\begin{document}
    \csvreader[
        head=true,
        tabularray = {
            width=\linewidth,
            colspec={r},
            },
        table head = {First\\},
        ]
        {example.csv}
        {}
        {\csvlinetotablerow}
\end{document}
```

The error is:
```

! Undefined control sequence.
\__hook_toplevel csvsimple/csvline -> \tl 
                                          _set_eq:NN \l _tmpa_tl \csvline \r...
l.26         {\csvlinetotablerow}
```



Is the hook correct? Or am I doing something wrong?


Top Answer
samcarter
Adding `\ExplSyntaxOn...\ExplSyntaxOff` seems to do the trick:

```
\begin{filecontents*}{example.csv}
A
"51,502"
"121,151"
\end{filecontents*}
\documentclass{article}
\usepackage{tabularray}
\usepackage{csvsimple-l3}

\ExplSyntaxOn
\AddToHook{csvsimple/csvline}
    {
        \tl_set_eq:NN \l_tmpa_tl \csvline
        \regex_replace_all:nnN { "([^"]+)" } { {\1} } \l_tmpa_tl
        \tl_gset_eq:NN \csvline \l_tmpa_tl
    }
\ExplSyntaxOff

\begin{document}
    \csvreader[
        head=true,
        tabularray = {
            width=\linewidth,
            colspec={r},
            },
        table head = {First\\},
        ]
        {example.csv}
        {}
        {\csvlinetotablerow}
\end{document}
```

![Screenshot 2026-03-10 at 15.16.30.png](/image?hash=ad06e0a71b1afdf3b2a28e7f1ad40c0c8a84032545332c2f0b1a245444bbaeb3)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.