« How to create a series, or just repeat a cell, in OpenOffice Calc spreadsheets | Main | Sorting mixed 5- and 9-digit zip codes in OpenOffice.org Calc or Microsoft Excel »

September 29, 2008

Cell formats, and using NOW() and other functions in OpenOffice Calc spreadsheets that you use in databases and mail merges

Mail merges work fine with spreadsheets as the data source. You create a spreadsheet of data, then choose File > New > Database, specify connecting to an existing database, Spreadsheet as the type, then click Next and point to the database itself.

Here are a couple things about formats, though.

Formats don't come through. So if you want your Salary field to have dollar signs, decimals, etc. you need to set the format. Likewise with date or time.

One way to do this is just set the formats when you view them. Press F4 and expand to view the query or table you want. Then just right-click on the column heading and choose Column Format.

Columnformat
Then in the window that appears you can select a category (Currency, Date, Number) and the the specific format you want. Click OK.

Datesetting

You can do the same thing in the database file itself. Open the .odb file, click the Tables or the Queries icon at the left, then double-click on the particular table (the sheet or query).

Edit

In the window that appears, right-click on the column heading, choose Column Format as before...

Datagain2

and in the window that appears, as before, make the choice you want. Click OK.

Datagain3

Now, here's a related topic. Can you use the =NOW() function in a spreadsheet and have it interpreted correctly in the database and in mail merges? (Thanks to a Colorado Springs LUG member for this idea.) The answer is Yes.

Here's a spreadsheet with =NOW() showing the absolutely current time and date.

Nowinspreadsheet

Here's what it looks like, with nothing done to it, in the database view. It needs some tender loving formatting since it's just showing the internal numeric value. Right-click on the column heading and choose Column Format.

Columnformat 

Set the format you want. The NOW() function can let you use a date or time format since it contains both.

Datagain3 

And now it looks fine in the database view.

Showdatainf4 

When I use this field in a mail merge....

Mailmmerge1

Here's the output when I format the field as a date:

Mailmergeoutput2 

and when I format it as a time.

Mailmerge3

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341cdb1753ef00e554fbd7048834

Listed below are links to weblogs that reference Cell formats, and using NOW() and other functions in OpenOffice Calc spreadsheets that you use in databases and mail merges:

Comments

Thanks for the info. I am trying to use this feature for a mail merge with time card information. In the spreadsheet, I have formatted the "time" cells to be [HH]:MM. This tells me the total number of hours worked.

However, when I apply the same format to my data source, it adds 48 hours to the total.

Do you have any ideas how I might correct this?

Additional information:
The spreadsheet file has many spreadsheets. The spreadsheet used as my data source is "Index". The total hours worked column that is used in the mail merge is actually a link to the total cell on the worker's individual page.

Just got Open Ofc 3.0. How do you make a page of address labels. Not from a database. Just manually putting in addresses for Christmas cards for instance. This seems like a very basic task but help is not helping me out any. (The old way of doing it was to go to Tools and go down to labels and envelopes.)

Thanks.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment