Sub topic 2
Protect the original: work on a copy
Cleaning tools change data in place, and some changes are hard to reverse. This chapter covers how to keep the original data safe before you run any cleanup. It assumes you can navigate a Google Sheets file, select ranges, use the menu bar, and write a simple formula such as =A1&B1.
Why the original needs protection
Several tools in this tutorial overwrite the cells you select. Data cleanup > Trim whitespace, Data cleanup > Remove duplicates, and Split text to columns all write their results back into the sheet. Remove duplicates deletes whole rows. Split text to columns can overwrite the cells to the right of your selection without asking.
Undo (Ctrl+Z or Cmd+Z) is not a safety net for a long session:
- Undo steps back through your actions in order. To recover one early mistake, you have to undo everything you did after it.
- Undo history is lost when you close the file or reload the page.
- Other people editing the file at the same time add their own changes to the history.
- You often notice a bad cleanup much later. For example, a lookup returns fewer matches than expected, or a pivot table shows a total that is too low.
A raw copy also lets you answer questions later, such as "Which rows did the dedupe remove?" and "What did this value look like before we trimmed it?" Without it, you can only guess.
Choose a protection strategy
You have four main options. They differ in cost, in how well they survive collaboration, and in whether they keep a link to the original.
| Strategy | How | Best for | Weakness |
|---|---|---|---|
| Duplicate the tab | Right-click the sheet tab, then **Duplicate** | Quick cleanup inside one file | Raw and clean data share one file, so someone may edit the wrong tab |
| Copy the whole file | **File > Make a copy** | Risky or large changes, or work you want to hand off | Creates a second file to keep track of |
| Name a version | **File > Version history > Name current version** | Marking a restore point without extra tabs | Restoring replaces the current file, so it is not good for comparing side by side |
| Keep a raw tab and build the clean tab with formulas | Clean tab pulls from the raw tab | Repeatable cleanup, especially for data that is re-imported | Needs formulas, and the output is formulas rather than typed values |
You can combine these. A common setup is to name a version, duplicate the raw tab, and work only on the duplicate.
Duplicate the tab
This is the fastest option and the one you will use most.
- Right-click the tab at the bottom of the window that holds your data.
- Choose Duplicate.
- Google Sheets creates a tab named
Copy of Sheet1and places it next to the original. - Rename both tabs right away. Double-click a tab name to edit it.
Use names that say what each tab is for. A pattern that works well is Raw_Customers for the untouched data and Clean_Customers for the working copy. Add the import date to the raw tab name if you will repeat the import, for example Raw_2026-11-28.
After you duplicate, check three things:
- Formulas that point to other sheets. A duplicated tab keeps its formulas, and references to other tabs still point at those tabs. If your raw data contains formulas, the copy may still read from the same sources.
- Filters and filter views. An active filter hides rows. Hidden rows are easy to forget, and some tools treat them differently from visible rows. Clear filters before you copy or clean.
- Row and column counts. Select the whole raw tab with Ctrl+A and note the last row. You will compare against this number in the final chapter on verification.
Then move the raw tab out of the way. Drag it to the far right, or right-click it and use Change color so you can tell it apart. Some people also hide it with Hide sheet, but a hidden tab is easy to forget, so a color and a clear name are usually better.
Copy the whole file
Use File > Make a copy when the cleanup is large, when you are unsure of the result, or when other people are editing the file. The dialog lets you:
- name the new file, for example
Customers - cleaning draft; - choose a destination folder;
- copy comments and suggestions along with the data;
- copy the sharing permissions, if you choose to. Leave this off unless you need it, because it can expose half-finished work to people who should not see it.
A file copy is independent of the original. Edits in one never change the other. It does not carry over the original's version history, so name a version in the original too if it matters.
You can also copy a single tab into another file. Right-click the tab, choose Copy to > Existing spreadsheet (or New spreadsheet). Formulas that referenced other tabs in the source file will show #REF! until you fix them, or will keep pointing to the original file after you approve access. Check the first few formula cells after copying.
Name a version as a restore point
Google Sheets saves a history of changes automatically. You can read it under File > Version history > See version history. The automatic entries are grouped by time and editor, so they are hard to search.
Before a risky step, name the current state:
- Choose File > Version history > Name current version.
- Enter a clear label, such as
Before dedupe.
Later, open the version history and look for your label. You can preview the version, then choose Restore this version to replace the current file with it. A restore overwrites the current state, so make a copy first if you want to keep your recent work. You can also open an old version and copy cells out of it into the current file.
Build the clean tab from the raw tab with formulas
Instead of editing a copy by hand, you can leave the raw tab alone and have a second tab read from it. The raw tab then never changes, and the clean tab updates itself if you replace the raw data.
On a tab named Raw, with headers in row 1 and data from row 2, this formula in Clean!A2 mirrors the first three columns:
=Raw!A2:CThe result spills into the cells below and to the right. The cells it fills must be empty, or you get a #REF! error that says the array result was not expanded. This is why the clean tab should start as a blank sheet.
You can then wrap the reference in the cleanup functions covered in later chapters. For example, this trims one column and keeps blank rows blank:
=ARRAYFORMULA(IF(Raw!A2:A="", "", TRIM(Raw!A2:A)))The tradeoffs matter:
- Advantage: the original is never touched, and the process is repeatable. Paste a new export into
Rawand the clean tab refreshes. - Cost: the clean tab holds formulas, not values. If you delete the raw tab, the clean tab breaks. If you sort the raw tab, the clean tab changes order.
- Extra step: when you want a fixed result, select the clean range, copy it, and use Edit > Paste special > Values only into a new tab. Do this only once you have checked the result.
Pasting values onto the same cells that hold the formulas is a common mistake. It replaces the formulas with static values, which is fine only if you meant to freeze the output. Keep the formula version in a tab you do not delete until the final result is approved.
Guard against imported data that refreshes
Some sheets pull data with IMPORTDATA, IMPORTRANGE, or a connected data source. These refresh on their own, so a copy that reads from them can change under you. Cleanup you did by hand on top of imported cells can also be lost or blocked when the import re-runs.
To protect yourself:
- Copy the imported range.
- Paste it as Values only into a new tab named
Raw_snapshot. - Do all your work from that snapshot.
The snapshot gives you a fixed starting point. If you need fresh data later, import again and make a new snapshot with a new date in the name.
Prevent accidents on the raw tab
If several people use the file, lock the raw tab:
- Right-click the tab and choose Protect sheet, or use Data > Protect sheets and ranges.
- Click Set permissions.
- Choose Restrict who can edit this range and select yourself, or choose a warning only.
A warning-only setting shows a message when someone edits, but still allows it. Restricted editing blocks them. Protection stops accidental edits by other editors. File owners can still change or remove the protection.
A short checklist before you clean
- Clear any filters and note the number of data rows.
- Name the current version, for example
Before cleanup. - Duplicate the tab and rename the original
Raw_...and the copyClean_.... - Protect or color the raw tab.
- Confirm the copy matches. This formula returns
TRUEwhen both tabs hold the same number of non-empty cells in column A:
=COUNTA(Raw!A:A)=COUNTA(Clean!A:A)Run that check before you start, and again after each step that should not change the row count, such as trimming or changing case. A step that removes duplicates should reduce the count, and you should be able to explain by how much.
Exercise
You duplicated a tab, then ran Data cleanup > Remove duplicates on the copy. Later you realize the copy has 40 fewer rows than the raw tab and you need to know which rows were removed. Why does keeping the raw tab untouched make this possible, and what would you do to find them?
Show answer
The raw tab still holds every original row, so you can compare it against the copy. For example, add a helper column on the raw tab with =COUNTIF(Clean!A:A, A2)=0 filled down, which returns TRUE for rows whose key value is missing from the clean tab. Filter on TRUE to list the removed rows. Without the raw tab, the deleted rows would be gone unless you could restore an earlier named version.
Exercise
Your Clean tab uses =Raw!A2:C in cell A2 and shows a #REF! error saying the array result was not expanded. What is the likely cause and the fix?
Show answer
The formula's output range contains non-empty cells, such as typed values or old data below or to the right of A2. Clear those cells, or move the formula to a blank area, so the result has room to spill.