Automation script, select to file as HTML table

I created an automation script to export results of a system table query showing each table in the database and the number of rows. However, when I export it to HTML, only the headers show up. Is there another step to getting the data into an HTML table?

For some reason it worked fine when I selected the query file as opposed to just pasting in the sql.