# Building tables using Latex

I am very new to LaTex I met it a week ago while trying to build tables of my results output from Stats I have read a lot of documentation but I have not been able to implement many. I discovered I can go from .csv or excel, I downloaded excel2LaTex add in and yet I not been able to use it after a lot of efforts. Can I get clear implementable guidance, probably how to build tables from excel or csv, dummy-level guidance. Thank you Dr Obum

• It might be easier to read the csv directly using csvsimple or pgfplotstable. The latter is better for numerical data. – John Kormylo Nov 7 '17 at 13:24

Welcome to LaTeX, the in-side of the typography magic.

What you are using seems to me more like a black-box, where you would be on the out-side, and everything is somewhat opaquely done by some "Wizard"

I would suggest you, rather to

1. open the csv with a notepad or any plain text editor,
2. replace each comma (,) with an ampersand (&)-- if possible separated by two spaces on both sides to improve readability, and then
3. include the whole data within this code:

\begin{table}
\begin{tabular}{l l l ...}
... ... ...
... ... ...
\end{tabular}
\end{table}


with so many l, c or rs as the number of columns in your Excel data (for left, center or right-justifying the contents).

At first, when I must create table I used outer tools which generate LaTeX code.This is some of them

My suggestion in three words: R, xtable, knitr. Save the example with .Rnw extension. You can compile it easily with Rstudio or see How to build Knitr document from the command line.

\documentclass{article}
\renewcommand\belowcaptionskip{1ex}
\usepackage{booktabs,verbatim,parskip}
\begin{document}
\subsection*{The original CSV file:}
% Just to make the table.csv
<<echo=F,comment="">>=
library(xtable)
table <- data.frame(A=c(1.234,2.123,3.1416,4.44,5.001),
B=c(21,12,23,14,45))
row.names(table) <- c("One","Two","Tree","Four","Five") # Ahem!
write.csv(table, file = "table.csv",row.names=T)
@
\verbatiminput{table.csv}

\subsection*{The \LaTeX\ table:}
<<results="asis",echo=F>>=
tablecopy <- read.csv(file = "table.csv",  row.names = 1, check.names = F)
print(xtable(tablecopy,caption="The CSV data"),
caption.placement="top",include.rownames=T,booktabs = TRUE)
@
\end{document}