This method is not really a library OR a program, but for ad hoc conversions you can
- put the HTML for a table in a text file called something.xls
- open it with a spreadsheet
- save it as CSV.
I know this works with Excel, and I believe I’ve done it with the OpenOffice spreadsheet.
But you probably would prefer a Perl or Ruby script…