April 25, 2019

Creating a Contacts Database in OpenOffice

Managing Contacts

  • March 20, 2008
  • By Carla Schroder

Last week we learned how to make pages of labels, business cards, and form letters using OpenOffice Writer and Base. The steps for setting up any mail-merge document in OpenOffice are easy; the one potentially gnarly bit is creating your contacts database in the first place. Your contacts list must be in Base, which is a bit of a pain. But the good news is Base can import data from most other databases, spreadsheets, text-delimited files, and email address books. Figure 1 shows the import screen. Yours may have some different options, depending on your Linux distribution.

Base can connect directly to most relational databases, such as MySQL, PostgreSQL, Oracle, Adabas D, or any database that supports the Open Database Connectivity (ODBC) or Java database connectivity (JDBC) drivers. So it also functions as a graphical front-end to other databases, and you can use it to edit and change them. Address books, spreadsheets, and delimited text files are read-only. You can import their data into Base, but whenever you make a change to the source document you have to import the new data; you can't change it or directly access it from Base.

My contacts are in a KDE address book. Importing this into Base is so easy your cat can do it:

  • File - New - Database
  • Connect to an existing database
  • Yes, register the database for me and open the database for editing
  • Click finish, name and save the new file
  • You will see something like Figure 2. Double-click on the Address Book table to see your imported data
If Base doesn't have an option to directly import from your address book, try exporting your addresses into a comma-delimited .csv file. Then in the "Connect to an existing database" dropdown list, choose "Text". The next screen asks for the path, be sure to check "'Comma separated value files ' (*.csv)", and then select the correct delimiters. If it is a correctly-formed .csv file Base will have no problems with it. Here is an abbreviated example from my KDE address book export:
"Family Name","Given Name","Honorific Prefixes","Home Phone",
"Home Fax","Home Address Street","Home Address City",
"Home Address State","Home Address Zip Code"
"Schroder","Carla","Ms.","","","5678 EndOfTheLineLane",
"Red Cowtown","Oregon","54321"

Even though there are line breaks for readability, the real line breaks are at the ends of the lines with no commas. You have to have the exact same number of fields in your field definitions line, which is the first line in the file, and in your data lines. In this example there are nine. Any empty fields need "" for a placeholder, and each field is separated by a comma. You can use a comma, single space, tab, colon, or a semi-colon for the delimiter.

Most Popular LinuxPlanet Stories