# Reading data from an ODS file in LaTeX?

I've been using csvtools to read data from CSV files. Is there any way to read data directly from a ODS file, to put the data into a LaTeX document?

-

## migrated from stackoverflow.comJul 8 '11 at 9:29

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question got migrated here from a different stackexchange site. Please also register yourself on this site and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Martin Scharrer Jul 8 '11 at 9:45
I'm afraid you're asking too much from TeX, which can read easily only text files. I think that in principle something can be done, but it would require building a complete parser of ODS. –  egreg Jul 8 '11 at 9:49
It depends how much work you want to put into that: with LuaTeX you can read ZIP files and parse XML files. So the answer is 'yes' if you have enough time. –  topskip Jul 8 '11 at 13:12
–  cjorssen Jul 24 '12 at 14:25

I don't think there is a LaTeX package for reading ODS (OpenDocument Spreadsheet) files directly. CSV files are text-based are therefore readable and parse-able by (La)TeX. However, ODS are (AFAIK) ZIP-ed XML files, which are a lot more complicated. You need to convert the ODS files first to CSV and then include it as such. This might be possible in the command line. More complex sheets (which don't fit in the CSV format) are not supported I guess.

In general LaTeX and OpenOffice/MS Office do not work well together and you can't simply move freely from one to the other.

-

[EDIT: removed non-answer] Maybe the way to go would be to use oo/libreoffice or something similar to convert osd to csv first. You can do this on the command line, so build it into scripts etc.

-
This doesn’t answer the question. ODS isn’t a plain-text format (it’s an OpenDocument Spreadsheet), and using plain text to display tabular data is completely inacceptable at any rate. –  Konrad Rudolph Jul 8 '11 at 9:09
The data is being read from a csv file, why not put it into a tabular format and include that? –  jaybee Jul 8 '11 at 9:14
Read the question again. The data is not being read from a CSV file but rather from an ODF file. Furthermore, including a file with tabular data is of course fine, but \VerbatimInput doesn’t do that. Rather, it includes a text file verbatim, that is without any formatting. You’d want to use \input instead. –  Konrad Rudolph Jul 8 '11 at 9:16
Uhhh, OK. Rather than reading the question again, it is more a question of reading it for the first time :-( –  jaybee Jul 8 '11 at 9:18
@jaybee: I would either move the EDIT to the front, if you want to keep your original answer, or simply replace it with your new suggestion. It's also possible to delete answers (I'm not saying you have to). –  Martin Scharrer Jul 8 '11 at 9:52