A short but useful function to store mail contents of a CF7 submission to a CSV file and clear the file after successful submission - got to keep GDPR happy...
Add the code to your functions.php file and adjust accordingly. You'll need to add your form ID, field names and CSV path (within uploads).
The code is commented fully but as mentioned your CSV file needs to be saved within wp-content/uploads to play nice with CF7 security.