DB query to Excel script no longer works in Ignition 8

I have a number of scripts which covert db queries to excel an email them out.
These no longer work ignition 8. I have fixed 2 things so far I’m stuck on the 3rd.
Here is an example of one of them.

I have replaced the old system.dataset.dataSetToExcel with the new system.dataset.toExcel
I have now included the database name in the system.db.runQuery, which I didn’t have to do before.

But now I am getting this error:

Here is the script: (sorry for small size, only way I could capture all)

Thanks

system.dataset.toExcel is already returning a byte[], don’t need to call encode on it as if it were a string that you needed bytes for.

Yes, of course. That’s it. Thank you very much.