Blog

Scanning a passport to Excel, three routes and their pitfalls

· 3 min read

You can get passport data into Excel by retyping it, by copying text from a generic OCR tool, or by using a dedicated MRZ reader that exports an XLSX file. Retyping needs nothing extra but is slow and easy to get wrong. The other two routes are faster, but the text still needs sorting into columns, and Excel changes some values as soon as you type or paste them. Format the columns before you enter data and most of the common errors can be avoided.

Route one: retype the data

Typing the fields yourself works for a handful of guests on one trip. You read each field from the data page and enter it into a row. The weak points are the passport number and the dates, where one wrong character is easy to miss. You can check the document number and dates against the check digits in the machine readable zone, but that is manual work. The MRZ check digit calculation article shows how.

Route two: generic OCR and copy and paste

A general OCR tool turns a photo into lines of text. You copy the lines into Excel and then split each one into columns yourself. The machine readable zone is one long string of capital letters, digits and < characters, so it does not split neatly at spaces. The letter O and the digit 0 are easy to confuse, and one stray space shifts every column after it. Why passport OCR fails lists the usual causes.

Route three: a dedicated MRZ reader

A dedicated reader parses the MRZ into named fields, checks the check digits, and exports a table, so there is nothing to split by hand. Look for a reader that lets you review and correct each field before export. Ask how the file is formatted, and open a test export in Excel before you rely on it. Fields outside the MRZ, such as place of birth and issue date, still have to be read from the printed page, so review them every time.

Excel pitfalls to fix before you type

Excel changes some typed or pasted values, and Microsoft documents several of these changes. Two of them matter most for passports.

Microsoft's guidance for both problems is in keeping leading zeros and large numbers and stop automatically changing numbers to dates.

The fix for passport numbers is to format the column as Text before you type. Select the column, press Ctrl+1 (Command+1 on a Mac), choose Text, and then enter the data. A text cell keeps the value exactly as you typed it, and sorting and lookups treat it as text. Formatting does not repair zeros that were already removed, so check the first entries again after you format. For a single cell, you can type an apostrophe first, and Excel stores the entry as text without showing the apostrophe.

For dates, pick one format and enter every date the same way. Real date cells sort correctly, while dates typed as text sort alphabetically. Check one row against the page before you fill in the rest of the column.

A sensible column order

A workable order is last name, first name, date of birth, place of birth, nationality, issue date, expiration date, passport number, rank and remarks. Names come first so the list sorts by surname. The passport number sits next to the expiration date, so the validity check is easy to make by eye. Rank and remarks go last, which keeps crew details apart from the identity data. If you build your own sheet, start from the crew list template and adjust the columns to your trip.

Where ScanPass fits

ScanPass is an iPhone app that we built for charter companies, marinas and yacht agents. Its crew and passenger list exports as XLSX with the columns in the order above, but the app is still in development and coming soon to the App Store, so you cannot download it yet. Until then, the Text formatting steps above work in any workbook.