Your database source needs to be xpath to use the export to excel and export to csv buttons. In an online application the from database and xpath sources work the same so you won't see a difference in your grid.
Found the answer on https://docs.mendix.com/refguide/export-to-csv-button in:
As such, it is only available in list widgets that use the XPath data source.
Unsure why this constraint exists (vs Database, Microflow, etc...), but using XPath datasource does work indeed.