Also see Querylet and Querylet::CGI, which do just that (and little more).
In reply to Re: adding database values to csv file by Corion in thread adding database values to csv file by vsurend