I just posted a cookbook article describing how to format relational data in CSVs:
Hope it helps.
Regards, Mark