A lead export can be valid CSV and still behave unexpectedly when a spreadsheet opens it. Contact Form 7 answers are visitor-controlled text. If a spreadsheet interprets an answer as a formula, a value that looked harmless in a form can acquire a different meaning in the reporting workflow.

The practical task is to preserve the original data while controlling how a particular spreadsheet imports it. This guide is an export-handling review, not a claim that a named plugin version contains a vulnerability. It uses harmless examples, not links, commands or formulas that contact outside systems.
Identify the actual exporter and consumer
Contact Form 7 itself does not provide a stored inbox of submitted messages. Your CSV may come from Flamingo, another storage plugin, an automation platform or a custom report. Record that exporter, its version, the selected fields and the application that will open the file. A file extension alone does not describe how values are escaped or typed.
For Flamingo’s normal selection and export workflow, see our Flamingo CSV export guide. Keep that operational task separate from this review of how the resulting cells are interpreted. Do not assume every exporter produces the same columns or transformations. Preserve protective prefixes supplied by your exporter; removing them for appearance can undo an intentional protection.
Understand the boundary CSV quoting does not cover
CSV uses separators, quotes and line endings to describe fields and records. Quoting a field lets it contain commas or line breaks without splitting the row. That structural escaping does not necessarily tell a spreadsheet to treat the resulting cell as plain text.
OWASP describes CSV injection as the interpretation of untrusted cell values as spreadsheet formulas. Its guidance includes formula-leading characters and separator or quote handling that can create new cell boundaries. The exact outcome depends on the consuming software and import settings. A check that only searches the first character of the entire row is inadequate when the risk belongs to every resulting cell.
A legitimate phone number beginning with a plus sign is also a useful reminder: unexpected interpretation is a data-quality problem even without malicious intent. You want the original phone string, not arithmetic, an altered identifier or a lost leading zero.
Make a small synthetic fixture first
Create a separate fixture outside the live lead system. Include an ordinary company name, a phone-like value beginning with plus, an identifier with leading zeros, an answer containing a comma, and an answer containing a line break. Add one deliberately harmless formula marker such as the following:
Example company
+123456789
00123
=1+1
These are individual test values, not a complete CSV document. Generate the fixture through a proper CSV writer or your approved staging exporter. Do not paste them into production forms just to test a spreadsheet. The only intended computation in the fixture is the local arithmetic marker; no external resources are involved.
Write expected outcomes before opening it: the arithmetic marker should remain literal text, the identifier should retain its zeros, and punctuation or line breaks should stay inside their intended cells. Record the application version and import route. A successful check in one spreadsheet does not establish behavior in another.
Choose the import route deliberately
In Excel, use the documented text/CSV import workflow so that you can inspect the preview and choose suitable transformations or column types. Directly opening a CSV may use default interpretation rules. An import preview is useful evidence, but verify the cells after loading as well.
For columns that contain visitor answers, explicitly preserve text where the import workflow supports it. This matters for names, messages, phone numbers and external identifiers. Keep your analysis formulas in separate columns that you create, rather than allowing imported lead text to supply executable spreadsheet expressions.
If the selected import route cannot reliably preserve the fixture as text, stop and change the workflow. An alternative is a maintained export that creates a workbook with explicit text cell types. Do not simply rename a CSV to .xlsx; that does not add typing or change its contents.
Keep a raw file and an analysis derivative
Preserve a restricted original export as the reference for reconciliation, with a clear retention decision. Create a separate analysis copy for transformations. Record which columns were transformed and why. That lets a reviewer distinguish the submitted answer from a display-safe derivative.
Prefixing values or removing characters can change real business data. An apostrophe may affect one application’s interpretation yet appear as data in another. Do not promote a universal character-replacement recipe without testing export, import, save and reopen behavior in the actual tools your team uses. OWASP explicitly discusses limitations of spreadsheet-oriented mitigations.
When building a custom PHP exporter, use the documented CSV writing API for structural serialization. Its delimiter and escaping controls solve a different problem from formula policy. Treat these as two separate review items: can the consumer parse the records correctly, and does each parsed cell remain data?
Verify the complete reporting handoff
- Import the synthetic fixture using the chosen procedure and inspect actual cell values and types.
- Save the analysis file, close it and reopen it through the team’s normal path.
- Check that identifiers, phone strings, punctuation and line breaks remain intact.
- Confirm that a second analyst can reproduce the same result from written instructions.
- Record the tested application versions and repeat the fixture when the exporter or consumer changes.
Apply the same discipline before emailing exports or handing them to another department. If the recipient will simply double-click a CSV, your carefully configured import session does not travel with the file. Agree on a documented import method or a typed derivative appropriate to that handoff.
Keep submission statistics separate from raw answers
A reporting question such as daily submission volume may not require message text or personal identifiers at all. Choose the smallest dataset that answers the question. Our monthly reporting guide helps define the measure before expanding an export.
For submission statistics and trends within WordPress, review Svetlik Analytics for Contact Form 7, our free plugin. That is a separate purpose from sanitizing or converting arbitrary CSV lead data.
