Question: how to export data to csv file using apex?
Answer: Run SELECT query on custom object., export the data to csv file., Automate / schedule step-1 and step-2 .