0

I have a file called "test,abc.csv" and I would like to use csvsimple to display this table.

\documentclass{article}
\usepackage{csvsimple}
\begin{document}
\begin{table}
\csvautotabular[respect all]{test,abc.csv}
\end{table}

\end{document}

It gives me an pgfkeys error Package pgfkeys Error: I do not know the key '/csv/abc.csv' and I am going to ignore it. Perhaps you misspelled it. \csvautotabular[respect all]{test,abc.csv}

Is there any way to solve this problem without changing the file name?

I have tried bracket, braces or quotes on the file names but none of them works.

(The reason why I don't change the file name directly is that I am writing a script to automatically display a list of tables from another database, where many file names contain comma. These tables are already linked to some other stuff, so changing the file names could lead to errors)

Dau Zi
  • 392
  • File names had not contains commas. Rename its name, for example to test_abc.csv. – Zarko Mar 05 '23 at 02:47
  • While TeX itself supports file name containing commas, I'd guess that csvsimple package does some processing on the file name that breaks when it has a comma. While there probably is some workaround (e.g. something like "if you wrap the file name in exactly 5 layers of braces it will happen to work") (try different number of layers of braces, I haven't tested), it's quite fragile, so I think a reasonable compromise is to use LaTeX to copy the file to another file name that does not have comma then read that file with csvsimple package – user202729 Mar 05 '23 at 07:54
  • In the meantime, you might want to report a bug to the csvsimple package maintainer. – user202729 Mar 05 '23 at 07:55
  • Displaying a list of tables inside a database doesn't export them. Having a *.csv file to be read in a tex file indicates you do export those tables to a comma delimited file. So IMHO there are two options: either rename directly when exporting or - as those *.csv files seem to be used elsewhere in that comma containing name format - add a copy / rename routine to your script. Use the renamed files as input in your tex file. You are writing a script anyway, so why not add that routine? – alchemist Mar 05 '23 at 09:34

1 Answers1

0

A workaround is to store the filename in a macro and use that macro as argument:

\documentclass{article}
\usepackage{csvsimple}
\begin{document}
\begin{table}
\def\myfile{test,abc.csv}
\csvautotabular[respect all]{\myfile}
\end{table}

\end{document}

Marijn
  • 37,699