The following AppleScript does just that for you. The output is placed on the clipboard, and formatted to be pasted into a spreadsheet. But since you have the code, you can modify ad lib. Enjoy! [robg adds: This worked as described for me, in 10.5.6. I'm not sure about 10.4.x compatibility.]

