Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I'd like to use LibreOffice Calc or MS Excel to create and edit spreadsheets and include these in LaTeX (LuaLaTeX would be fine, too). It is necessary for me to get calculated values like SUM(C2:C5) as well.

So far I've tried odsfile and exceltex. Where odsfile didn't work at all, exceltex did work but ignored calculated values.

Has anyone successfully tried to include spreadsheet data with calculated values?

Update

This question is not the same as "I'd like a easy interface for LaTeX-Tables", as I look for a more comprehensive solution. We use spreadsheets for modeling our problems. When we refine our models, I'd like to update the TeX-based reports without exporting/importing many tables.

That said, odsfile works pretty much as I wanted to.

Thanks for your comments and suggestiongs so far. Do you know any other solutions like odsfile?

share|improve this question
    
Most of the spreadsheet softwares are able to generate a .csv - a list of comma seperated values (which will contain also calculated values, afaik). From there you could try to make your way with a perl script or something similar. –  Ruben Jan 27 at 11:58
    
This works fine with export to .csv. I do it regularly. I just use a bash script to transform things and then use merge to pull it into a LaTeX template. Very straightforward once you've set it up. (Of course, if you edit the spreadsheet, you need to regenerate the .csv.) I use LibreOffice's Calc. I imagine Excel would work, too, but haven't tried that. –  cfr Jan 27 at 12:15
1  
did odsfile produce some error message? could you send me some sample file which failed to work? (I am the author of odsfile) –  michal.h21 Jan 27 at 12:35
    
I noticed that I had not the most recent version. After upgrading it works well :-) –  Marcus Bitzl Jan 27 at 14:21
add comment

marked as duplicate by lockstep, Jesse, Guido, Thorsten, Svend Tveskæg Jan 27 at 12:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

Whichever tool you use, you will hit a rock one day. This is a hack that I use:

enter image description here

In excel use the concatenation command to translate the cells to have the & inserted to the left at a mirror of the columns somewhere to the right of your columns.

Cut and paste as needed. Takes a few minutes, saves tonnes of time on complicated tables that you use all the time.

It also produces very neat tables when pasted to the editor.

enter image description here

And if you are not up to speed with LaTeX table will help you learn how to do it. It is not an automated tool, but has a good understandable workflow that you are fully in control. Alternatives tend to need a lot of clean up later.

share|improve this answer
add comment

TeXShop (for the Mac) includes a very handy macro for pasting MS Excel cells from the clipboard into LaTeX.

As an example, I opened a new Excel spreadsheet, typed 4 into cell A1, 3 into A2, =SUM(A1+A2) into B1 and =A1*A2 into B2. I then selected the four cells, copied them to the clipboard, opened TeXShop, and selected the command Macros > Paste Spreadsheet Cells. A dialogue box opened, and I chose the option simple. The resulting output was:

\begin{tabular}{ll}

4 & 7 \\
3 & 12 \\

\end{tabular}

Another option might be use the TeXTable or similar software.

share|improve this answer
add comment

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