I use the term database loosely here -- it can be an actual database, or a spreadsheet (in any format including CSV) or can be package-dependent.
Is there a way to create mail-merged documents similar to what can be done in word processing packages? I found the mailmerge
package which sort of works but it puts all the mail-merged data into one document.
Is there a package or way to generate new, individual documents for each part of the database? In other words, if I have a firstName
value in whatever storage system, can I get LaTeX to generate a file called <firstName>.dvi
for each of the names in the database? Or do I need to resort to a scripting language driver to pull that off?
EDIT
So to further explain what I am trying to do (and will now set it up based on the answer to Change document class per page ) :
I'm trying to create a "welcome to the company" sort of document that has a cover page, table of contents, welcome letter, then various sections of information. I've never tried this in anything other than a word processor where it's easy to set "master pages" or "template pages" for individual pages in the document. So I could use a letterhead template page for the welcome letter part and a standard article-type template for the rest and still have the letter numbered/referenced in the ToC.
If I use the approach on the answer there, how can I tell \pdfpages
which page to include? Ultimately I would like to have many files like Bob.pdf
, Sue.pdf
, John.pdf
etc. where each file is the same document with a custom letter embedded within.
datatool
package can be used to process a CSV file, and then you can extract the appropriate pages from the PDF file.welcome.tex
which includes Bob-letter.pdf and then outputswelcome-bob.pdf
, etc. for each person? You don't want 1 document which includes separate letters for Bob, Sue, etc. I would be inclined to script that part.Bob-letter.pdf
, I'll just haveletters.pdf
which has Bob's letter on some page. So thewelcome.tex
used to createwelcome-bob.pdf
would need to know the same database asletters.pdf
in order to know which order the pages are in. If that makes sense...