Back to Community

Troubleshooting Common CFDB7 CSV Export Errors and Data Issues

30 threads Sep 17, 2025 PluginContact form 7 database addon – cfdb7

Content

Exporting data from the Contact Form 7 Database Addon (CFDB7) is a core feature, but it can sometimes fail with confusing errors or produce corrupted files. Based on community reports, here are the most common CSV export and data display problems and how to resolve them.

1. PHP Warnings and 'Headers Already Sent' Errors

Users often report errors like Warning: Invalid argument supplied for foreach() and Cannot modify header information - headers already sent during export. These are typically PHP warnings that are being output to the browser, which interferes with the script's ability to send the HTTP headers required to start the CSV download.

Why it happens: These warnings are usually triggered by trying to process malformed or corrupted form entry data stored in the database. A common cause is a mismatch in serialized string lengths within the form_value field.

How to fix it:

  • Enable Debugging: Temporarily enable WordPress debugging to get more specific error messages and identify the problematic entry.
  • Identify the Bad Entry: The errors often point to a specific file and line number (e.g., admin-form-details.php on line 48). This frequently indicates one specific form entry is corrupted.
  • Manual Cleanup: If you have database access (e.g., via phpMyAdmin), you may need to locate and delete the corrupted entry from the wp_db7_forms table. Look for entries where the serialized data is incorrect, such as a string length that doesn't match the actual string.

2. CSV Export Timing Out on Large Datasets

For sites with hundreds of thousands of entries, clicking the export button often results in a timeout error and a blank page.

Why it happens: The export process is a single, long-running HTTP request. Web servers and browsers have a maximum execution time limit. Trying to process and generate a CSV file for 500,000 entries in one go will almost always exceed this limit.

How to fix it:

  • Increase Timeout Limits: Try increasing the max_execution_time and memory limits (memory_limit) in your php.ini file. Values like max_execution_time = 1800 (30 minutes) may be necessary for very large datasets.
  • Server-Level Export: For extremely large datasets, the most reliable method is to query the database directly using a tool like phpMyAdmin or a command-line SQL client and export the data to CSV from there. The data is stored serialized in the form_value column, so you would need to unserialize it in your query or during post-processing.
  • Filter Your Export: If possible, use date filters to export data in smaller chunks rather than all entries at once.

3. Incorrect, Missing, or Misaligned Data in CSV

This is a widespread issue with several causes:

  • Adding New Fields Later: If you add new fields to a form after it has already received submissions, the CSV export can become messy. The plugin may misalign data for older entries that don't have the new field.
  • Repeater Fields/Arrays: Forms using plugins like 'CF7 Repeatable Fields' or array-based inputs (e.g., name="job[0][number_1]") often export incorrectly. The CSV headers are typically built from the most recent submission, so if an older submission had more repeated fields, that extra data may be missing or misaligned.
  • Column Order Changes: Some users report that the order of the last few columns in the export is inconsistent.

How to fix it:

  • Understand the Limitation: Be aware that changing a form's structure after collecting data will complicate exports. For critical projects, finalize your form fields before publishing.
  • Data Processing: For one-time exports of messy data, the most practical solution is often to export the data and then clean and align it manually in a spreadsheet application or using a script.

4. Character Encoding Issues (Accents Show as ç)

Text with special characters or accents may appear correctly in the WP admin but become garbled (e.g., movimentação) in the CSV export.

Why it happens: This is usually a character encoding mismatch where the data is stored in UTF-8 but the CSV file is not being explicitly marked as such, causing Excel or other programs to misinterpret it.

How to fix it:

  • Open the exported CSV file in a plain text editor like Notepad++ or VS Code.
  • Ensure the file is saved with UTF-8 encoding.
  • When opening in Excel, use the import data feature and explicitly specify that the file origin is UTF-8.

5. Excel Cannot Open the CSV File

Users may see errors like "The file format and extension don't match" or "Excel has detected that 'file.csv' is a SYLK file".

Why it happens: The SYLK error occurs if the first two characters of the CSV file are 'ID', which Excel mistakenly interprets as a SYLK (Symbolic Link) file. This can happen if the first field in your form is an ID field.

How to fix it:

  • Open the CSV file in a text editor and ensure it does not start with the string "ID".
  • You can add a comment character like # to the very first line of the CSV as a temporary workaround.
  • Alternatively, open the file in another spreadsheet program like Google Sheets or LibreOffice Calc, which will not have this issue, and then save it in a different format.

While the 'Contact Form 7 Database Addon – CFDB7' team is responsible for the plugin's development, these community-troubleshot workarounds can help you recover your data and complete your exports when you encounter common problems.

Related Support Threads Support