You should be able to get the correct file by setting up the columns in a grid and use the standard export button with the CSV option. Alternatively you could use the module from the marketplace: https://marketplace.mendix.com/link/component/432 that will cover your needs I think.
I haven't updated the module for a while but this should be straightforward enough opening it a a lower version an then upgrade to the desired version and export the module and import it into your project.