Automatically import/export file csv

What method is possible to program and automatically import and export data in csv format?