2

I want to include a csv file as a table into my overleaf-document.

\documentclass[a4paper]{article}
\usepackage{csvsimple}
\csvautotabular{population.csv}

I have no idea, why it is not working. Does someone know ? ;-)

Katrin Menne
  • 21
  • 1
  • 2
  • First of all look at the MWE in my answer here: https://tex.stackexchange.com/a/578577/231952. Then edit your question, possibly providing a MWE. Your code, as it is, can not work: for example, \csvautotabular must be used in the document body not in the preamble – Ivan Mar 06 '21 at 19:15
  • Hi Ivan, thanks for your response! I do include it in the document body. Do I have to do overwrite the file as you did? (That would be a huge amount of characters)
    \begin{filecontents*}[overwrite]{test.csv}
    game id,start,dimensions,number of players,error type,survived rounds,avg iter dur,max iter dur
    1,,{(46, 58)},6,--,3,0.0189638150252525,0.070585
    1,,{(46, 58)},6,--,3,0.0189638150252525,0.070585
    ...
    6,,{(42, 71)},5,--,63,0.006719767371205704,1.936
    \end{filecontents*}
    
    – Katrin Menne Mar 06 '21 at 21:09
  • 1
    You do not need filecontents in the real life. It's mostly useful for producing minimal working examples. – Ivan Mar 06 '21 at 21:26
  • Well, then I still don't know my mistake. I did everything exactly like you suggested :( Do you know another package which I could try? – Katrin Menne Mar 07 '21 at 07:48
  • in order to help you, you should open a new question, provide a MWE and explain the details of your problem in more depth. If the code of my answer below doesn't work, it's probably an Overleaf issue. – Ivan Mar 07 '21 at 10:15

1 Answers1

2

Suppose we have this external test.csv file:

Lorem,Ipsum,Dolor,Sit,Amet
one,one,one,one,one
two,two,two,two,two
three,three,three,three,three
one,one,one,one,one
two,two,two,two,two
three,three,three,three,three

Then the following code

\documentclass{article}
\usepackage{csvsimple}

\begin{document}

\csvautotabular{test.csv}

\end{document}

will produce this:

enter image description here

Ivan
  • 4,368