6

Good morning everyone,

I have been trying to export Excel tables to my Overleaf file. I have succeeded to some extent using \includegraphics command, but the problem with that is that the font size is not editable on Overleaf. The attached is done using the command.

enter image description here

I have also tried to convert Excel to a .tex file using an add-in excel2latex but it did not work very well on Overleaf.

Could you please provide more tips or advice?

cmhughes
  • 100,947

5 Answers5

9

One possible solution I can think of from the top of my head is to load the excel table with the python module pandas and than use the export as tex file function in pandas.

#As example:
import pandas as pd
df = pd.read_excel(excel_file.xlsx)
df.to_latex(output.tex)
Mibi
  • 486
3

Have you tried saving the excel file as a CSV and importing it to:

https://www.tablesgenerator.com/

You will have to do the formatting again but you can get it exactly how you want it and fairly quickly

2

A bit late answer, but I hope that future users would be able to take advantage of this. Tables Generator now gives the possibility of generating a LaTeX table directly from copy-paste a table from Excel. Just create the table in Excel, copy it, than on Tables Generator click File -> Paste table data. It is also possible to paste with formatting. The only feature you will lose is the border widths.

mao95
  • 121
1

Generate your data as a CSV file. Use the datatool package to load and display the data.

\document{article}
\usepackage{datatool}
\DTLloaddb{data}{myfile.csv}
\begin{document}
\DTLdisplaydb{data}
\end{document}
0

By now you can also input your data as text in ChatGPT and ask it to "Please return the LaTeX code of the below table for me".

[Examplary table code]

It will produce a basic table you can then adjust.