Graphics, Figures & TablesCommands to Import Excel Table to Latex

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
esong_98
Posts: 16
Joined: Tue Jan 14, 2014 9:34 am

Commands to Import Excel Table to Latex

Post by esong_98 »

I downloaded an addin to my excel file that exports tables in Excel 2010 to Latex. In Latex, I wish to import a table in the appendix, with the following code:

Code: Select all

\appendix
\appendixpage

The following parameters and its values are presented on the following table.
\begin{table}
	\centering
		\begin{tabular}
			
		\end{tabular}
	\caption{Policy regime comparisons assuming zero elasticity with respect to taxes and subsidies.}
	\label{tab:PolicyRegimeComparisonsAssumingZeroElasticityWithRespectToTaxesAndSubsidies}
\end{table}
But I don't know what the actual command is to import the table. In Excel I click on convert table to Latex. I get an error message stating: The file could not be assessed. Try one of the following: ....

I believe the problem has do with making sure the file specified exists. But I'm not sure.

I've browsed past posts to see if I can solve this problem. But I couldn't find a post that went into great detail on how to convert an excel file with this addin feature into Latex. I believe the add in feature is excel2latex.

Can anyone help?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Commands to Import Excel Table to Latex

Post by Johannes_B »

Have you tried »one of the following«?

Auto generated code is usually bad, sometimes very very bad. Please have a look at the documentation of package booktabs. You can find general tips for laying out tabular material there. Good tables, like the ones in scientific journals follow a few basic and simple rules.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
esong_98
Posts: 16
Joined: Tue Jan 14, 2014 9:34 am

Re: Commands to Import Excel Table to Latex

Post by esong_98 »

:evil: :cry: "The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary."

What an insult. I browsed this site for a good hour for an answer, and only asked the question when I couldn't find an answer. Thumbs down. Why do computer science people always answer your question with the answer "Read the manual?

Nevertheless, I ditched my exel addin and used an online Latex table generator. It wasn't perfect, but it will do.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Commands to Import Excel Table to Latex

Post by Johannes_B »

Hi, it wasn't my intent to make you feel insulted. This is my standard signature and is posted with every post i am doing here. It reminds me as well to act in a calm way.

The fact is, that i don't know this feature of excel, and i don't know what the suggested methods for trouble shooting are.
One thing i know for sure (from experience), is that table making is really simple, if you keep the table simple. If it is hard to write the LaTeX code, the table will be hard to read for the reader later as well.
Some people put myriads of vertical bars in their tables, making it really hard to grasp the concept of what is going on.

If the table is just some data, you can read the data file (as text) directly, and LaTeX will do the work for you. I bet we can find a solution to nearly any problem. ;-)
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
esong_98
Posts: 16
Joined: Tue Jan 14, 2014 9:34 am

Re: Commands to Import Excel Table to Latex

Post by esong_98 »

You're forgiven. I thought your signature was the standard answer for a comment deemed not to have met the guidelines of this web site.

My guess is that the old excel addin is not compatible with later versions of Excel. But the online latex generator did a pretty good job. The tables I am generating are quite large, and the online site was able to adjust the table size to fit in one page so that I don't have to landscape the table. I could have saved it as a picture file, but I spent alot of time without success trying to adjust the picture size without having any data being cutoff from the table. The only problem with the online table generator is that the coloring commands failed, and the table was done in black and white. I wanted coloring as a categorization device.

Going through this process, I discovered how to easily adjust picture sizes so that you don't get bad box warnings. You copy and paste your pictures in Paint, then click on the crop button. Then you insert the picture into Latex. You do not have to make any size or crop adjustments in Latex. The picture is automatically pasted in your latex file being the appropriate size with all of the extra white deleted from the picture.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Commands to Import Excel Table to Latex

Post by Johannes_B »

Hi, i think Excel can export to pdf as well (cropping can be done by pdfcrop). Having a real pdf (i hope this is what excel exports) is nice, you can zoom in and out without any pixel issues. Paint can only handle pixel images, which when zoomed in show the indivual pixels. It's like standing real close to the TV.

Some pdfs (a vector format in general) just include a pixel image, which would just be nonsense.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply