Suppose you have an localc spreadsheet myspread.ods and you want to insert the content of the range H4:I40 as a table into your latex document. I know that I can export the table or just do some copy and paste. However is it possible to write something like:

\includespread{file=myspread.ods,range=H4:I40}

Then the table in my LaTeX-document changes when the corresponding spreadsheet changes.

Would be nice to have also the possibility to modify global appearence properties of the table as optional arguments of \includespread.

This isn't really possible in (PDF)LaTeX: .ods files are actually zip archives. Maybe with LuaTeX, which has a zip library, but then you need also to interpret the XML files contained in the archive.
–
egregJun 19 '12 at 12:18

From sample file I created, it seems that sheet data are saved in office:document-content / office:body / office:spreadsheet / table:table path. Table rows are saved as table:table-row and cells as table:table-cell. Each cell has set datatype of its content, if cell contains formula it is saved in table:formula attribute. In every case, computed value ready for print is contained in subelement of table-cell, text:p. I hope this structure is created also with different versions of Open/Libre Office Calc than is mine, otherwise the code will be not working :(

With LuaXML, we can convert xml into lua tables, which can be then easily processed using standard lua techniques.

Function odsfile.load(filename) returns odsfile object, with loadContent() method, which returns lua table representing content.xml file. We can select sheet from spreadsheet with odsfile.getTable(xmlobject,sheet_name). If we omit sheet_name, first sheet from spreadsheet is selected.

Data from sheet can be read with odsfile.tableValues(sheet, x1, y1, x2, y2). x1 - y2 are range to be selected, they can be null, in which case whole rows and cells are selected. For converting of standard range expressions of form a1:b2 to this representation, function odsfile.getRange(range) can be used.

You can probably do this by passing out a pipe of commands via \write18 to unzip the document.xml to stdin and into lxprintf (part of the LTxml suite from
http://www.ltg.ed.ac.uk/software/ltxml/ which lets you extract content from XML) and then munge the result via awk or whatever. Or just use Perl/Tcl/Python.