# How to read a csv file having #

I want to read from a csv file:

\documentclass{article}
\usepackage{csvsimple}
\begin{document}
\csvautotabular{initial.csv}
\end{document}


Now my initial.csv file looks like this:

a, # b
1, 3


It creates the following errors:

Illegal parameter number in definition of \csv@col@body \csvautotabular{initial.csv}
Illegal parameter number in definition of \csv@temp \csvautotabular{initial.csv}
You can't use macro parameter character #' in restricted horizontal mode \csvautotabular{initial.csv}


Then I tried with replacing # by \#. It gives:

Missing \endcsname inserted \csvautotabular{initial.csv}
Extra \endcsname \csvautotabular{initial.csv}
File ended while scanning use of \pgfkeys@temp


Any idea on how should I try if my csv file contains some #'s?

• {\catcode#=12 \csvautotabular{initial.csv}} Aug 15, 2014 at 4:04

As @wipet wrote, the problem is the catcode of the # sign. With the recent version 1.12 (2014/07/14) of csvsimple, you can neutralize the # sign with the respect sharp option:
\documentclass{article}

There are some more respect xy options which also may be interesting for other use cases, e.g. respect and (for &) and respect dollar (for \$).