Thanks!
I had found the wpgr post via google, but it's not quite what I need to do.
The jetpack post views module might work, this script might be handy:
<?php if ( function_exists('JPV_display_top_posts') ) { JPV_display_top_posts( $args ); } ?>
Luckily, it looks like the old script still works. I wish the csv.php page had more code samples!