Export report to csv via deluge script

Export report to csv via deluge script

Hi, is it possible to export a report into a CSV file from a deluge function?
If so is there a limit to the number of records that can be exported? 
In my system I need to create a CSV file (actually I'd need an XLS file but I think XLS file has a narrower limit on number of records than a CSV file; I guess 2.000 records for XLS) to send to my partner for processing.

I might do it manually, but I'd like to automate the process if possible.

Furthermore,  for smaller exports I'd like to create a weekly schedule and in that case it would be nice to find a way to directly attach the file, maybe saved in a google drive or Zoho Docs, to the email inside the same script to have the action completely automated.