Best method to update form letter data

Newbie. Using LibreOffice 7.4.0.3 on Mac Monterey 12.4
Transitioning from Word

I have form letters that go out every month to different targets (renewal letters, thank you’s, etc)
I have set up the form letter and connected to a data source.

What I have done with Word for years is use my master database with a procedure to select the desired names, give them the appropriate code for the conditionals and save the data as a tab delimited text(.txt) file. I use the same name and location for the text file, so it just over writes the data from the previous month. I then open the Word doc, it opens and confirms the text file is the one I want and then I can merge the letter.

Does this method work in Writer (haven’t been able to get it to) or do I have to re-register the text file as the datasource each time? Is

I have no problem outputting the text file as .csv or .tsv file if that makes things easier.

Thanks

You register a database only once. A database can be any SQL database connectable via ODBC or JDBC. Apart from true databases, LibreOffice supports dBase files, text files, spreadsheets or even text tables in Writer documents.

[Some kind of database] —> [Base document] —> [Office Document]

In your particular case you may link a directory of similar tab-separated text files to a Base document. This way each text files appears in the Base document as a table of some pseudo-database.
menu:File>New>Database… type:Text, specify directory, separators, encoding. The resulting database document will NOT contain any data. It only stores the connection settings.
Optionally, you may add simple queries to modify the sort order, column order, column labels of one table or apply some filter(s).
The database is registered under some short name, by default it is the name of the database document without .odb suffix.
In Writer hit Ctrl+Shift+F4 for the data source window.
In the left pane you see your registered database with tables and queries.
RIght-click>“Edit database” opens the selected database document.
Right-click>“Registered databases” shows a list with all registered databases (also via Tools>Options… Base>Databases).

  1. You have a registered database in the data source window connected to whatever.
  2. You have a form letter.
    When you select a table or query in the left pane, the record set appears in the right pane from where you can drag&drop column labels into your Writer document as mail merge fields.

Later, when you need to use another text file, put it in the same directory as the other text files. In Writer call menu:Edit>Exchange Database… and point to the new table. This will modify the mail merge fields accordingly.
If your mail merge fields are linked to a query, open the database document, edit the query and change the table name, so the query does the same thing with another table.

2 Likes

Thanks, this is helpful.

1 Like