I am writing documentation for a build log that needs to have part numbers inserted. Rather than have someone go through and update part numbers in a document to reflect revisions and updates, I wanted to have parts simply listed in an excel spreadsheet (possibly across sheets to organize them) with static line numbers (so I can reference that in LaTeX somehow). Then, revisions could be made to the spreadsheet and the document recompiled.
What I would like is a command like this:
\insertdata{filename.xlsx}{sheetname}{linenumber}{pn}
which would produce a part number. The last two arguments are basically a row/column selector ("pn" representing "partnumber" but could also be "name" or "description", etc. for various data stored in that row).
I have seen that the exceltex
package could be re-wrapped to do this, but I am working on Windows, and I can't guarantee that others using this will have Cygwin installed, so it needs to be fully reliant on a rather stock Windows environment.
I would also prefer not to export the spreadsheet as a CSV, unless that can be integrated in the builder somehow.
If it's relevant, I am using MikTeX 2.9 and Sublime Text 3 with LaTeXTools on Windows 8.1.
Thanks!
Best Answer
The
datatool
package has a Java helper applicationdatatooltk
that has a batch mode and a GUI mode. The batch mode is the default and allows it to be integrated into the document build process. Using this sample XLS file as an example, I can fetch the data from the first sheet (labelledproducts
) usingdatatooltk
and store it indatatool
's internal database structure:I've included
arara
directives, but if you're not usingarara
the build process is (assuming the file is calledtest.tex
):