Keep Leading Zeros in Google Sheets IDs Before Pasting or Importing

Protect fictional six-digit order IDs from numeric conversion in Google Sheets by treating them as text and verifying the source file against the sheet.

Google SheetsFictional practice dataEnglish captions
Start with a practice file

Try the example, then check the result.

Download the fictional material and follow the steps below. The video uses English illustrative diagrams; it does not present a live app recording. Product controls may vary by version.

Check the answer before applying the method to your own data. How we review guides ↗

Video walkthrough

Watch the complete lesson.

The video uses English illustrative diagrams; it does not present a live app recording. English captions. Product menus may differ in your account.

Quick answer

Format destination cells as Plain text before pasting the practice IDs. Confirm 001245, 000327, and 010004 remain six-character strings.

Before you start

Use the fictional six-digit-ids-practice.txt and work in a disposable copy. Compare your result with the independent answer-check.md. Use only fictional data.

Step 1: Keep 3 Six-Digit IDs Intact

A six-digit order code can begin with zero. If Google Sheets interprets it as a number, the visible 001245 may become 1245, changing the identifier used for matching. We will preserve three fictional IDs as text before entry and check that each still has six characters. We are not adding zeros to a price or doing arithmetic on an ID.

Step 2: Keep an untouched source

Open the local practice text file and read all three fictional IDs: 001245, 000327, and 010004. Keep this source unchanged. It is the independent reference if an import strips zeros. Record that the specification is six digits for this exercise; in a real dataset, confirm the field definition before deciding whether padding is legitimate.

Step 3: Prepare text cells first

In a disposable Google Sheet, label A1 Order ID and select the destination cells in column A. Set their number format to Plain text before pasting the IDs. Google's number-format guidance explains how to change a selected range. If you use the file import flow instead, inspect its conversion choices and do not accept a result until the source digits match.

Step 4: Paste and inspect stored values

Paste one ID per row, then click each cell and read the formula bar. The first ID must still include two leading zeros; the second must include three; the third begins with one. Visual padding from a custom number format could look correct while the stored numeric value is different, so check the actual cell content as well as its display.

Step 5: Test all three lengths

In a spare column, use LEN on A2, A3, and A4. Each result should be six because the stored identifiers are six characters long. A result of four or three signals that the original leading zeros were lost. If that happens, do not fix a real production file from memory; reset the disposable copy and paste again from the untouched text source.

Step 6: 3 IDs Keep Their Leading Zeros

When the original text is still available, the safest correction is to re-import it as text. A six-digit TEXT formula can make a known numeric code display with zeros, but that is a reconstruction based on a specification, not recovery of unknown source digits. Finish by matching each cell to the original file, not by judging appearance alone.

Check your result

The plain-text source contains exactly 001245, 000327, and 010004 in that order. In the Sheets practice copy, cells A2:A4 must display and store those six-character strings. =LEN(A2) through =LEN(A4) should each return 6; check the formula bar as well as the visible cells. If a numeric import already changed them to 1245, 327, and 10004, return to the original text and re-import as text rather than guessing the lost digits.

Limits and troubleshooting

Formatting as Plain text after leading zeros have already been discarded cannot reconstruct unknown original IDs. A custom 000000 display or TEXT(number,"000000") can pad to six digits only when a six-digit specification is known; it is not proof of the original value. Import and paste behavior can vary by UI flow and locale, so compare stored values against the original text source.

Product references

Take the example with you

Practice downloads.

The exercise files contain invented information. Save a local copy before editing.

Keep exploringBrowse published workshop guides