Best method to get a .csv/ excel file filled by the API?

I am currently using File Search but should i also use Code Interpreter? I’ve tried it multiple times, it gives me the right .csv file 1 time and then doesn’t again so not sure. Looking for some guidance!