6

I have an excel file including the following table. How should I create something similar to it? Is it better to use the table code in latex or make a figure from it and import it to latex (I did this but the quality of picture was so bad).

If I have to create a table, how should I automatically import those values to latex, because the values are too much to be written without any automatic routine.

enter image description here

enthu
  • 3,795

1 Answers1

8

This should help you. Save the contents of your excel sheet as csv file and use it in the LaTeX code. Here is an example:

enter image description here
The above is an excel sheet. Saving it in csv format as contents.csv.

natural,two,three
1,2,3
2,4,6
3,6,9
4,8,12
5,10,15
6,12,18
7,14,21
8,16,24
9,18,27
10,20,30

Now, the following code illustrates an example:

\documentclass{article}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstabletypeset[
    col sep=comma,
    string type,
    columns/natural/.style={column name=natural, column type={|l}},
    columns/two/.style={column name=two, column type={|l}},
    columns/three/.style={column name=three, column type={|c|}},
    every head row/.style={before row=\hline,after row=\hline},
    every last row/.style={after row=\hline},
    ]{contents.csv}
\end{document} 

enter image description here

subham soni
  • 9,673