5

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?

3
  • Why do you cover the table by black rectangle? If you don't want to show us the information, you can type in each cell A, B, C, or something like that.
    – user156344
    Nov 5 '18 at 15:53
  • 2
  • 1
    When I want to retain the exact formatting, I usually save the sheet as pdf and then include as graphics in latex.
    – nidhin
    Nov 6 '18 at 6:23
5

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)
2
  • 2
    Thank you for suggesting a solution. Unfortunately, I have not used Python before. Nov 5 '18 at 15:48
  • Thank you! The only fix is that pandas does not interpret xlsx, only xls. But it is a great solution!
    – Pereira
    May 1 at 22:28
2

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
  • I've used this before, but this site seems to be broken now: it dumps all the table's data into just the first column. Feb 10 '19 at 4:17
  • works for me real good.
    – Cohensius
    Oct 24 '19 at 12:11
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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.