Data masking: how to mask PII in spreadsheets and documents before you share them
Data masking replaces part of a sensitive value, such as all but the last 4 digits of an account number, so the data stays useful without exposing the real thing. This guide is for people who want to mask PII in a spreadsheet or document before sharing it with an AI app or a colleague, and shows how to do both in Fileshape.
The short answer
Three words get used as if they meant the same thing, and they don't, which is worth sorting out before picking a tool.
- Masking hides part of a value and keeps its shape. 4417 1234 5678 9012 becomes XXXX XXXX XXXX 9012. You can still tell two accounts apart, and you can't read either.
- Redacting removes a value completely and leaves a mark where it was, like a black bar or [NAME]. It's the usual word for documents.
- Anonymizing means changing a whole dataset so that nobody can work out who a row is about, even by combining columns. It's a much higher bar than the other two.
Masking is not anonymizing
This is the catch people miss. If you mask the name and account number in a list of transactions but leave the dates, amounts and merchant names, someone who knows a little about the person can often still pick them out. The masked column was only one of the things pointing at them.
So I'd treat masking as a way to share less, and not as a way to make data anonymous. It lowers what an AI provider, a contractor or a leaked file can reveal. If you need data that is anonymous in the legal sense, that's a job for a privacy specialist and usually for aggregation, and no column tool gets you there by itself, mine included.
What kind of data masking tool do you need?
Search for a data masking tool and most results are for databases: software that copies production data into a test environment with the personal fields scrambled. If you're an engineer with that problem, that's the category to look at, and Fileshape isn't in it.
The problem I see more often is smaller and more everyday. Someone has a CSV export or a PDF and wants to ask ChatGPT or Claude about it without handing over every customer's phone number. That needs a tool that works on one file at a time, in a minute or two, and that's what the rest of this page is about.
How PII detection works (and where it fails)
Fileshape finds personal data in two ways. It reads the column header, so a column called "Mobile No" or "Date of birth" is flagged whatever is in it. And it looks at the values: if most of a column looks like email addresses, PAN numbers or card numbers, it's flagged even when the header says something unhelpful like "Field 7". Card numbers have to pass the Luhn checksum, which is handy because it stops a column of order IDs being mistaken for cards.
What it looks for: emails, phone numbers, account and card numbers, IBANs, UPI IDs, PAN, Aadhaar and SSN numbers, names, addresses and dates of birth.
No detector catches everything, and free text is where they all struggle. A notes column that says "spoke to Ravi, call back on 98765 43210" has a name and a number in it that column rules can't separate from the rest. Read a few rows of every text column yourself.
How to mask a spreadsheet
In Fileshape you decide column by column, and there are three choices:
- 1. Add your CSV, Excel or JSON file on your files page. Nothing is uploaded when you pick it.
- 2. Go through the columns. Each one is set to Share (sent as it is), Mask (last 4 characters kept, the rest replaced with X) or Hide (left out entirely). Columns that look personal start as masked or hidden.
- 3. Change anything you disagree with and check the preview.
- 4. Upload. Only what you shared or masked is stored, and your AI apps can then query it.
If you only want a masked file to download
You don't have to connect anything. Hide, Mask and Shrink gives you the same three choices and a cleaned copy to download and attach to a chat yourself. There are pages with each app's limits for ChatGPT and Claude.
A masked value always comes out the same way, so two rows with the same card still match after masking. That's what keeps questions like "spend per card" working. Emails keep their first letter and domain (r***@example.com), so you can still group by company.
How to mask or redact PII in a document
Documents don't have columns, so the approach is different. In the mask editor you drop in a PDF, Word or text file, and the personal details found in the text are masked to begin with. You switch off what you'd like to keep and select anything else by hand.
There are three styles. X out and keep the last 4 is the masking one. Black out and the [NAME] label style are closer to redaction. For a PDF, the download is rebuilt from pictures of the pages, so the masked text isn't in the file any more. The step-by-step is in how to redact a PDF, and there's a page on Aadhaar and PAN numbers too.
What I'd mask, and what I'd leave alone
Hide what the question doesn't need. Names, home addresses and dates of birth rarely matter for a spending or sales question, so they can simply go.
Mask what you need as a label. Account numbers, card numbers, phone numbers, emails and ID numbers are useful for telling rows apart, and the last 4 characters do that fine.
Leave amounts and dates alone. A scrambled amount protects very little and quietly ruins every total, and you'd never know. If a figure is too sensitive to share, hide the column and ask a different question.
And remember that masking the file is half of it. The other half is the AI app's own settings, which I went through for Claude and ChatGPT.
Ask AI about this file
Ask ChatGPT, Claude or Cursor about your file. Fileshape cleans it, masks personal columns and gives your AI one link, so totals come from every row.
FAQ
Questions
What is data masking?
Replacing part or all of a sensitive value with placeholder characters so the data can be used without exposing the real value. A common form keeps the last 4 digits of a number and replaces the rest with X.
What is the difference between data masking and anonymization?
Masking hides individual values. Anonymization changes a whole dataset so no person can be identified from it, even by combining columns. Masked data is usually not anonymous.
What is PII masking?
Masking applied to personally identifiable information: names, emails, phone numbers, addresses, account and card numbers, and government ID numbers.
Is there a free data masking tool for CSV and Excel files?
Yes. Fileshape's Hide, Mask and Shrink page masks or hides columns in a CSV or Excel file and gives you a cleaned copy. The mask editor does the same for PDF, Word and text files without an account.
Will totals still be right after masking?
Yes, as long as you mask identifiers and leave amounts and dates alone. A masked identifier always comes out the same, so grouping by it still works.
Does masking make it safe to upload a file to ChatGPT?
Safer, not risk-free. Masking cuts down what the provider receives, but free-text columns can still hold names, and combined columns can still point to a person. Hide what you don't need and check the app's data settings too.
More from the blog
Keep reading
- Claude MCP: how to add connectors in claude.ai, Claude Desktop and Claude CodeThe three ways to add an MCP server to Claude: custom connectors in claude.ai, the Claude Desktop config file and claude mcp add in Claude Code.
- ChatGPT MCP: how to add an MCP server (what used to be a custom connector)Which ChatGPT plans can add a custom MCP server, the steps on the Plugins page, sign-in options and limits, with a spreadsheet server as the example.
- Filesystem MCP server: what it is, how to set it up, and where it stopsWhat the official Filesystem MCP server does, the Claude Desktop config for it, its tools and limits, and what to use in claude.ai or ChatGPT instead.
- The best MCP servers for files, by what you need them to doAn honest list of MCP servers for files, picked by job: local folders, CSV and Excel, Google Sheets, PDFs, databases and cloud drives.
Updated 2026-12-06