exporting CSV based on number of rows