# trouble with a simple csvsimple and csvautotabular table

I have a csv file, keywords_table.csv. I made it in Excel. Here it is:

Keyword Category,Number of keywords used in searches,Examples
Names of drugs,111,"tamoxifen, aspirin, tamiflu"
Names of categories,15,"cancer drug, NSAID, flu vaccine"
"Synonyms for ""child"" and ""pediatric""",11,"pediatric, child, prepubertal, adolescent, teenage, early life, kid"
Names of physiological systems,47,"urinary, hematologic, cardiovascular, musculoskeletal, endocrine, sensory, reproductive, skin, salivary"
Exclusion terms,5,"mouse, mice, rat, animal model, scale, addict"


My goal: put a table in my LaTeX document. I'd like to do it with a separate csv file, since that's easier to update for me in other software instead of having to change values manually inside a standard Latex table.

I've been trying for a few hours now to use csvsimple to do so, but I haven't succeeded. I've read through that package's documentation and various examples online to try and get this thing to work, but no dice. I'm very much a LaTeX novice, so I apologize if this is a trivial question.

My LaTeX workflow is MikTex on Windows 10 Pro, and I'm using TexMaker. I'm rendering with XeLaTeX and BibTex. Here's the code I use to try and get the table going with csvautotabular, including my preamble:

\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{csquotes}
\MakeOuterQuote{"}
\usepackage{csvsimple}
\usepackage{longtable}
%\usepackage{tikz}
%\usepackage{pgf}
\usepackage{graphicx}
%\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{fullpage}
\usepackage{setspace}
\usepackage{fontspec}
\usepackage{color,soul}
\usepackage[left]{lineno}
\linenumbers
\doublespacing
\usepackage{anysize}

\usepackage[
backend=biber,
style=apa
]{biblatex}

\title{HEY LOOK A TITLE}
\author{ME}

\begin{document}
\maketitle

\csvautotabular{keywords_table.csv}

\printbibliography

\end{document}


The code executes perfectly well if I remove \csvautotabular{keywords_table.csv}. That's all I'm trying to do. I don't care about formatting or anything.

Here's a screenshot of the litany of error messages that TexMaker spits back to me when I try to run XeLaTeX:

These are uninterpretable to me. Where is it inserting anything? I've gone through my whole document to see if there were missing {'s or }'s to no avail. Like I said, the document runs without the \csvautotabular line.

Sorry again for this. I'd be very grateful for any help.

I would wait and see if there are better answers since I have very little experience with this type of import

However here is my novice attempt at above. I have had to modify your csv to suite the loading method so a modified copy to simplify \headings and "{include, commas}" is imbedded in the following, once it runs save out the filecontents to an external file as testing.csv delete that section and see how it loads. In your own solution the csv can be any external name.

\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%\usepackage{csquotes} % had problems trying to get complex file to use this package
%\MakeOuterQuote{''} % had problems trying to get complex file to use this package
\usepackage{csvsimple} %csvsimple is not able to cope reliably with " delimited comma entries
\usepackage{longtable}
%\usepackage{tikz}
%\usepackage{pgf}
\usepackage{graphicx}
%\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{fullpage}
\usepackage{setspace}
\usepackage{fontspec}
%\setmainfont{Adobe Garamond Pro} % I usually have problems with this family
\usepackage{color,soul}
\usepackage[left]{lineno}
\linenumbers
\doublespacing
\usepackage{anysize}

\usepackage[
backend=biber,
style=apa
]{biblatex}
%\addbibresource{C:/stuff/bib.bib} % don't have this stuff

% filecontents for demo can be external as per comment below
\begin{filecontents*}{testing.csv}
Category,Number,Examples
Names of drugs,111,"{tamoxifen, aspirin, tamiflu}"
Names of categories,15,"{cancer drug, NSAID, flu vaccine}"
"Synonyms for child and pediatric",11,"{pediatric, child, prepubertal, adolescent, teenage, early life, kid}"
Names of physiological systems,47,"{urinary, hematologic, cardiovascular, musculoskeletal, \cr && endocrine, sensory, reproductive, skin, salivary}"
Exclusion terms,5,"{mouse, mice, rat, animal model, scale, addict}"
\end{filecontents*}

\title{HEY LOOK A TITLE}
\author{ME}

\begin{document}
\maketitle

%\csvautotabular{keywords_table.csv} replaced with modifications per answer by egreg
%see https://tex.stackexchange.com/questions/424207/unable-to-print-without-quotes-in-csvsimple
tabular=|l|c|l|,
table head=\hline Keyword Category & Searches & Examples of each\\\hline,
late after line=\\\hline,
before reading={\catcode\"=9}

• Thanks for this! I'd seen solutions based on begin{filecontents*}` but have avoided them for now since I'd like to avoid having to update a table's values inside the latex document. But if that's where I end up, that's what I have to do I guess. – logjammin May 7 '19 at 0:36