As the article linked by @MikeMadern suggests:
in your web host control panel, go to PHPMyAdmin
select the table
select Export, configure the format
further down in the same screen, select the Save as file and Go
Or, as the same article suggests, just use a plugin:
Pulls comments out of your WordPress database for backups or analysis.
If you have
WP_DEBUG enabled, the plugin dumps a couple of warnings, but it's nothing critical, and it works as expected.
Just retrieved an old script and adapted to WordPress (using the query from Export Comments as example). Put the file in the root of WP installation and access directly, it will export an Excel file with the comments.
It would be much better to have this as a plugin with security checks and all.
Remove from server after using. Or maybe put it in a folder as
index.php and set an
define( 'WP_USE_THEMES', false );
require( './wp-load.php' );
$query = "SELECT * FROM $wpdb->comments
WHERE 1 = 1
AND ( comment_approved = '1' OR comment_approved = '0' )
ORDER BY comment_ID DESC";
$error = "Error: the query failed...
$result = $wpdb->get_results( $query, ARRAY_A ) or wp_die( $error );
$header = array_keys( $result );
$html = array();
$html = "<tr><td>" .implode( "</td><td>", $header ) . "</td></tr>";
foreach( $result as $row )
$html = "<tr><td>" .implode( "</td><td>", $row ) . "</td></tr>";
$html = "<table>" . implode( "\r\n", $html ) . "</table>";
$fileName = 'Comments_' . date("Ymd") . '.xls';
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=$fileName" );