The function-backed export needs to return a String-type and the filetype will be added to the filename based on what’s selected in the configuration.
So if you want to export a CSV based on what’s in the table, but you want to process it a bit first, then you’d need to write a function that takes in an object set (or object list), uses the .all() to retrieve the objects. Iterate through them, doing whatever modification you need, and build the CSV output.
If it’s a relatively large object set, you probably want to write it as an async function and then process each object => csv row in an async map operation. If you are struggling with the Typescript for that, AIP Assist should probably have a good idea how to do it or if that doesn’t help I could whip up an example.