You must send an Excel workbook to a vendor, an auditor or a customer. Or you must find which workbooks on a file share hold personal data. Before you do this, you must know what personally identifiable information (PII) is in each file.
The usual check is to open the workbook and look at it, or to use Find. That check misses a lot. A workbook can keep PII in places that you do not see when you open it.
This guide shows where PII hides in an Excel file, which of those places a scan reads, and how to scan one workbook or a folder of them.
Where PII hides in a workbook
We made a small test workbook, staff.xlsx. All the values in it are made up. It has these items:
| Place in the workbook | What we put there |
|---|---|
| Visible cells | Two names, two phone numbers, two e-mail addresses |
| SSN column, no format | 212456781, stored as a number |
SSN cell with the ;;; format |
301224455. The cell shows nothing. |
| A hidden column | The two phone numbers |
| An e-mail cell with white text | [email protected] |
A hidden sheet, Old |
Lena Ortiz, 078-23-4512 |
| A cell comment | Old SSN on file was 523-71-8834 |
| The page footer | A name and an SSN |
| The file properties | The author's name |
When you open this workbook in Excel, you see two names and two SSN cells that look like plain numbers. One SSN cell looks empty. You do not see the hidden sheet, the hidden column, the white text, the comment text or the footer.
Why Find and grep miss most of it
Excel's Find does not search a hidden sheet. To search it, you must unhide the sheet first. A sheet that a macro set to "very hidden" does not show in the Unhide list.
A text search on the file itself finds nothing. An .xlsx file is a ZIP package of compressed XML files, so grep and findstr do not see the cell text:
$ grep -ac '078-23' staff.xlsx
0
SSNs stored as numbers
Excel's "Social Security Number" format shows 021-34-5678, but the file keeps the number 21345678. The leading zero and the dashes are not in the file. A search for the pattern NNN-NN-NNNN cannot find these SSNs. Our test workbook keeps two SSNs as numbers. Many real HR exports do the same.
What a scan reads
We ran PII Crawler's text extractor on the test workbook. This command shows the text that the scanner sees:
$ piicrawler textextract staff.xlsx
===== staff.xlsx =====
Name SSN Phone Email
Rachel Rodriguez 212456781 (415) 555-0142 [email protected]
Marcus Webb 301224455 (212) 555-0187 [email protected]
Employee SSN
Lena Ortiz 078-23-4512
Old SSN on file was 523-71-8834, check with payroll
The scan reads these places:
- All sheets. Hidden sheets and very hidden sheets are read the same as visible sheets.
- All cells. Hidden rows and columns, white text and cells with the
;;;format are read. The scan reads the stored value, not the value that Excel shows. - Cell comments. Both the old notes and the threaded comments of Excel 365 are read.
- Files pasted into a sheet. A PDF or Word document that is inserted as an object is read.
- Pictures on a sheet. A screenshot or a scanned page goes through OCR (text recognition), unless you use
--no-ocr.
The scan does not read these places:
- Headers and footers. The footer SSN in our test was not read.
- File properties. The author name, the title and the other document properties are not read.
If your workbooks can hold PII in a header or in the file properties, open File > Info > Check for Issues > Inspect Document in Excel. The Document Inspector shows these items and can remove them.
What the scan found
With the default detectors, the scan found all the PII that the extractor read:
| Type | Found | Where |
|---|---|---|
| SSN | 4 | Two stored as numbers (one with ;;;), one on the hidden sheet, one in the comment |
| 2 | One of them in white text | |
| Phone | 2 | Both in the hidden column |
| Name | 3 | Rachel Rodriguez, Marcus Webb, Lena Ortiz |
The SSN detector does not need the dashes. It found 212456781 and 301224455 in their number form.
How to scan one workbook
Install PII Crawler and register it (registration is free). Then scan the file:
piicrawler scan staff.xlsx --summary
--summary prints a count for each PII type. Remove it to see each finding. The report masks each value that it shows.
To look for only some types, use --only:
piicrawler scan staff.xlsx --only ssn,credit-card
To find your own identifiers, such as employee IDs, add a pattern with --regex:
piicrawler scan staff.xlsx --regex 'empid=EMP-\d{6}'
How to scan a folder of spreadsheets
To check all workbooks in a folder, scan the folder and limit the scan to spreadsheet files:
piicrawler scan /srv/share/Finance --ext xlsx,xlsm,xls,xlsb,ods,csv --save --name "Finance spreadsheets"
--save keeps the results, so you can make an HTML report for an auditor with piicrawler report, or export the findings with piicrawler export. For a Windows share, see how to scan a network share. For SSNs in all file types on a share, see how to find Social Security numbers on a file share.
The scan runs on your computer. The workbooks do not go to a cloud service.
Frequently asked questions
Which Excel formats can PII Crawler read?
.xlsx, .xlsm, .xltx, .xltm, .xls, .xlsb and .ods. CSV files are read as text. Cell comments are read from .xlsx packages.
Does the scan change the workbook?
No. A scan only reads files. Files change only when you run an action list, and the action list shows a preview first.
Can I remove the PII after the scan?
The scan tells you which files to fix. In Excel, delete the cells, the sheets and the comments, and use the Document Inspector for the headers, footers and properties. Then scan the file again to make sure that no PII is left.
What about card numbers in spreadsheets?
The credit card detector checks the Luhn checksum, as it does in other files. For a full PCI DSS search, see cardholder data discovery for PCI DSS.