Scrub PII from CSV Files Before Sharing or Uploading
CSV files carry more PII than any other export format. CRM exports, HR spreadsheets, billing records, and support ticket dumps all default to CSV, and each row can contain a dozen identifiable fields such as names, emails, phone numbers, addresses, and account numbers.1 Sharing or uploading a CSV without scrubbing means every consumer of that file inherits the full data liability.
The risk multiplies when the destination is an AI tool. CSV content uploaded to analytics platforms, pasted into LLMs for processing, or shared with data vendors exposes every row to systems outside your control.2 Scrubbing PII from the CSV text before it leaves your machine removes the identifiable values while preserving the structure and non-sensitive content that downstream workflows need.
What PII appears in CSV files
Customer CSVs typically contain email addresses, phone numbers, and physical addresses. HR CSVs add Social Security Numbers, salary figures, bank account details, and IBAN payment references. Billing CSVs include credit card numbers, card types, and associated email addresses. Building on this, many CRM exports include internal IDs, account numbers, and customer-facing domain names that may qualify as indirect identifiers under GDPR or CCPA. The scrubber detects all 22 standard PII types and replaces each with a numbered token so structure is maintained while values are hidden.
You should assume that any CSV exported from a business system contains PII until you verify otherwise. Even exports that appear structural, such as a product catalog or inventory list, may contain supplier contact emails or internal cost codes that qualify as business-sensitive data. The scrubber processes every line of the CSV in a single pass, so there is no performance penalty for scrubbing a file that turns out to contain no PII. The cost of one unnecessary scrub is a few seconds. The cost of one missed credential in a shared CSV can be a compliance incident.3
Scrubbing CSV text in practice
Open the CSV in a text editor or copy its content directly from a spreadsheet application (Excel, Google Sheets, LibreOffice). Paste the raw CSV text into the scrubber. The tool processes every line simultaneously, detecting emails, phone numbers, IBANs, and credit card patterns across all rows. Consequently, a 500-row export is scrubbed as fast as a 5-row sample. Download the variables file to maintain the mapping, then paste or save the scrubbed CSV for sharing with your AI tool, vendor, or internal data team.
When you copy from a spreadsheet application, the clipboard typically contains tab-separated values rather than comma-separated values. The scrubber handles both formats equally well because it processes the text as a flat string, not as a parsed table.4 After scrubbing, the output uses the same delimiter as the input. If you pasted tab-separated data, the scrubbed output is tab-separated and can be pasted directly back into your spreadsheet without reformatting. This makes the scrub-and-restore workflow seamless for spreadsheet-heavy teams.
Maintaining CSV structure after scrubbing
The scrubber replaces only the sensitive values. Commas, column headers, non-PII fields, and numeric values remain intact. A CSV with headers like email,phone,account_id,plan becomes the same header row followed by rows where email and phone are tokenized but account_id and plan remain readable. Yet this structure preservation depends on the scrubber detecting values correctly, so review the variables file after scrubbing to confirm every detected item was expected and check that non-PII numbers like account IDs were not flagged as SSNs or credit card numbers.
After scrubbing, validate the output by spot-checking a few rows against the original. Confirm that the column count per row has not changed, that quoted fields containing commas are still properly quoted, and that the header row is intact. For CSV files with complex quoting (fields that contain commas or newlines within quotes), the scrubber preserves the quoting structure because it operates on the raw text without parsing the CSV grammar.4 A quick visual check of the first and last few rows is usually sufficient to confirm structural integrity.
Common CSV export sources and the PII they contain
CRM platforms generate the most PII-dense CSV exports in most organizations. A Salesforce CSV report that includes Account and Contact objects can contain email addresses, phone numbers, mailing addresses, and company-associated names in a single export file. HubSpot contact exports add lifecycle stage, original traffic source, and associated deal values alongside contact identifiers. Marketo form submission exports include user-submitted form fields that may contain free-text entries with personal information beyond what the form was originally designed to collect.
HRIS platforms produce CSV exports with the highest regulatory sensitivity. Workday and BambooHR payroll exports include employee SSNs or national tax IDs for payroll processing, IBAN numbers for direct deposit, personal email addresses collected during onboarding, and salary data in numeric form. These files require scrubbing before any use with AI tools, even for structural tasks like reformatting column headers or generating payroll summaries.
Filtering which columns to scrub in large CSV exports
For large CSV exports where only specific columns contain PII, copy the PII-containing columns rather than the full file. In Excel or Google Sheets, select the email, phone, and SSN columns using Ctrl+Click on column headers, copy, and paste into the scrubber. Download the variables file and the scrubbed column values, then replace the original column values in your spreadsheet with the scrubbed version before any sharing or analysis step. This targeted approach reduces variables file size and makes the token-to-value mapping easier to review than scrubbing a full wide-table export.
Using the variables file to reconstruct and validate scrubbed CSV data
The variables file the scrubber generates maps each token to its original value in a downloadable JSON or CSV format. For CSV workflows where you later need to restore AI-generated analysis results back to real values, the Restore tab accepts both the variables file and the text containing tokens. Pasting an AI-generated CSV analysis response into the Restore tab and uploading the variables file replaces every token with the original value in one pass, producing a final output that reads with real names and contact details while never having transmitted them to the AI provider.
Validating the variables file after a large scrub is a critical quality step. Open the downloaded JSON and scan the detected entries to confirm that every token maps to an expected value and that no legitimate data fields (such as numeric account IDs or order numbers) were incorrectly tokenized. Credit card detection uses Luhn algorithm validation to reduce false positives, but 16-digit account numbers that happen to pass the Luhn check may still be captured.5 Correcting these in the variables file before restoration prevents incorrect substitutions in the final output.
Maintaining referential integrity across multiple scrubbed CSV files
When sharing multiple related CSV files with an AI tool (for example, a customer file and an orders file that share a customer email as the join key), scrub both files in the same browser session without closing the tab between pastes.6 Within a single browser session, the scrubber assigns the same token to the same value across all pastes. An email that appears in both files receives [EMAIL_1] in both, preserving the join key relationship in the tokenized output so the AI can correctly associate orders with customers across tables.
Sharing scrubbed CSV data with AI analytics tools
ChatGPT's Advanced Data Analysis feature accepts CSV files as uploads and runs Python analysis on them.7 Uploading a scrubbed CSV provides the full structural data that analysis requires: column names, row counts, value distributions, and aggregations all work correctly on tokenized data. The AI can generate pivot tables, calculate summary statistics, and produce charts from the scrubbed file. Only value-based lookups that require matching real email addresses or phone numbers against an external reference fail with tokens, and these can be handled post-analysis using the variables file to re-map results.
Pandas-based AI prompts that ask the AI to write Python code for CSV manipulation work fully with tokenized CSV. Generated Pandas code operates on the token strings as if they were real values; column filtering, merging, groupby operations, and string pattern matching on non-PII fields all function correctly. After the AI generates the analysis code, run it on the original CSV locally (not via the AI) when real value output is needed, since running the same code on real data locally avoids the tokenization round-trip for workflows where the final output requires original values.
Browser performance considerations for very large CSV pastes
The scrubber processes text in-browser with no character limit imposed by the tool. For CSV files with hundreds of thousands of rows, pasting the full content may cause brief processing delays in browsers with limited JavaScript heap. In Chrome and Edge, increasing the heap size using the js-flags launch flag set to max-old-space-size=4096 provides more headroom for very large pastes. For CSV files above 50,000 rows, processing in chunks of 10,000 rows per paste keeps each processing step fast and keeps the variables file per chunk small enough to review manually.
The chunking approach keeps the variables file reviewable even for very large exports, because each paste produces its own mapping. Since CapyToolkit processes the CSV entirely in your browser with no upload, you can split a 100,000-row file into manageable pieces without ever sending a row of customer data to any server.
When to use this
Use this before sharing any CSV export with an AI tool, external vendor, or analytics platform. Whenever the file contains customer emails, phone numbers, payment data, or employee records, flag payment fields before an external CSV share so downstream recipients never see the raw values.
Examples
CRM customer export
name,email,phone John Smith,[email protected],+1-415-555-0100 Sarah Lee,[email protected],(312) 555-0182
name,email,phone John Smith,[EMAIL_1],[PHONE_1] Sarah Lee,[EMAIL_2],[PHONE_2]
Each unique value gets its own numbered token, so [EMAIL_1] and [EMAIL_2] restore independently.
HR payroll CSV with employee SSNs
name,ssn,iban Alice Brown,123-45-6789,GB29NWBK60161331926819 Bob Davis,987-65-4321,DE89370400440532013000
name,ssn,iban Alice Brown,[SSN_1],[IBAN_1] Bob Davis,[SSN_2],[IBAN_2]
- 1.
Mark Tressler, "Export to CSV – The Widespread Security Risk in Plain Sight," rowzero.com, September 2024. https://rowzero.com/blog/export-to-csv-security-risk
- 2.
Lokke Moerel and Marijn Storm, "Data subjects as controllers: Violation of GDPR's fairness principle," iapp.org, September 2024. https://iapp.org/news/a/data-subjects-as-controllers-violation-of-gdpr-s-fairness-principle
- 3.
Microsoft, "Supported entities," microsoft.github.io, accessed June 2026. https://microsoft.github.io/presidio/supported_entities/
- 4.
Y. Shafranovich, "Common Format and MIME Type for Comma-Separated Values (CSV) Files," RFC 4180, IETF, October 2005. https://www.rfc-editor.org/rfc/rfc4180.html
- 5.
Stripe, "What is the Luhn algorithm and how does it work?," stripe.com, accessed June 2026. https://stripe.com/resources/more/how-to-use-the-luhn-algorithm-a-guide-in-applications-for-businesses
- 6.
Skyflow, "Tokenization," skyflow.com, accessed June 2026. https://docs.skyflow.com/docs/tokenization/overview
- 7.
OpenAI, "Data analysis with ChatGPT," help.openai.com, June 2026. https://help.openai.com/en/articles/8437071-data-analysis-with-chatgpt