This excellent script can be found at http://reallyshiny.com/scripts/table-extractor.txt