Back to Blog
Spreadsheets & Templates • 11 min read • By Julius

How to Validate Spreadsheet Data Before Generating Documents

How to Validate Spreadsheet Data Before Generating Documents

Validating spreadsheet data before document generation prevents polished files from carrying incorrect names, dates, totals, or identifiers. A Word template can control layout, but it cannot repair unreliable source data.

The safest process checks structure, required values, formats, relationships, and business rules before any documents are created. This guide gives a practical validation routine for Excel, CSV, or Google Sheets data used to produce Word and PDF files.

Why validation must happen first

Document generation repeats data at scale. That is useful when the data is correct and risky when it is not. One wrong spreadsheet formula can affect a whole batch. One shifted column can place a fee in a date field. A clean PDF can make the result look trustworthy even when the source was wrong.

Validation should answer two questions:

  1. Can the system read the data correctly?
  2. Is the data acceptable for this business process?

The first question covers headers, cell types, and file structure. The second covers rules such as required approval, valid currency, date order, and unique document numbers.

Keep raw data separate from prepared data

When data comes from another system, keep an unchanged copy of the export. Prepare a separate working sheet for generation.

A simple workbook may contain:

  • Raw_Export: unchanged source data;
  • Prepared_Data: cleaned fields used for generation;
  • Validation: checks and error messages; and
  • Lookup_Lists: approved currencies, statuses, countries, or template names.

This separation makes transformations visible. It also lets you compare the prepared values with the original source.

Do not hide unexplained manual corrections inside the final sheet. Record the reason or fix the source system where possible.

Check the header row

The first row should contain one unique name for each column. Good headers are short, clear, and stable.

Use names such as:

Document_ID
Client_Legal_Name
Issue_Date
Currency
Total_Amount

Avoid:

  • blank headers;
  • duplicate names;
  • merged header cells;
  • decorative title rows above the table;
  • headers such as Value or Other; and
  • changing a header without updating the Word placeholder.

If placeholders use the same names, mapping is easier to review. The Word template variable parser can help you compare a template's fields with the sheet.

Define required fields by document type

Not every column is required for every document. Create a short data dictionary that says:

  • field name;
  • meaning;
  • required or optional;
  • expected type;
  • allowed values;
  • example; and
  • owner.

For a contract, Client_Legal_Name, Effective_Date, and Currency may be required. Middle_Name may be optional. For a certificate, a course title and completion date may be required instead.

An empty required value should stop the affected document. It should not become a blank line that a reviewer might miss.

Validate text fields

Text checks are not only about spelling. Confirm that:

  • leading and trailing spaces are removed;
  • identifiers keep important leading zeroes;
  • names use the correct legal or customer record;
  • line breaks are intentional;
  • prohibited control characters are removed;
  • values fit any known length limit; and
  • the character set handles names such as Jørgensen or Hoffmann & Söhne.

Do not automatically change names to title case. AB, GmbH, product names, and surnames can be damaged by broad capitalization rules.

When a text field will become part of a file name, validate it separately. Slashes, colons, and quotation marks may be invalid or unsafe on some systems.

Validate dates explicitly

Dates often fail because spreadsheets can display one thing while storing another. A value such as 03/04/2026 is ambiguous across locales.

Use a true date cell where possible and apply one display format. For source exchange or identifiers, the ISO pattern 2026-04-03 is clear. The document can show a reader-friendly version such as 3 April 2026 if that is required.

Check business relationships too:

  • end date is not before start date;
  • due date is not before issue date;
  • birth date is not in the future;
  • an expiry date is still valid at generation time; and
  • reporting periods do not overlap unexpectedly.

Do not treat an empty date as zero. Decide whether it is optional, unknown, or an error.

Validate numbers and currency

Store numbers as numbers, not as text containing currency symbols. Keep currency in a separate field when more than one currency is possible.

For example:

Quantity Unit_Price Currency Line_Total
4 125.50 EUR 502.00

Check:

  • numeric cells do not contain words;
  • decimal separators are interpreted correctly;
  • negative values are allowed only where intended;
  • percentages use the right scale;
  • rounding follows the business rule;
  • currency is present; and
  • totals reconcile with their component values.

If a total is calculated, protect or clearly mark the formula. If people can overwrite formulas with pasted values, add a check that identifies the change.

Find duplicates before file generation

Duplicate rows can create duplicate documents or overwrite file names. Define which field or field combination must be unique.

Typical unique keys are:

  • invoice number;
  • purchase order number;
  • contract reference;
  • employee ID plus document type; or
  • participant ID plus course date.

A duplicate client name may be valid. A duplicate invoice number may not be. Use the business key, not a general “remove duplicates” command.

Also check whether two different records will produce the same output file name.

Use controlled lists for categories and status

Values such as country, currency, language, template, approval status, and delivery method should come from an approved list where possible.

Without control, a status may appear as:

Approved
approved
APPROVED
Approved 

These look similar to a person but can behave differently in filters or rules. Data validation lists in Excel or Google Sheets can prevent the variation at entry time.

Do not silently map an unknown value to a default. Flag it for review.

Validate addresses as structured data

A single address block is convenient, but separate fields are easier to check and reuse:

  • address line 1;
  • address line 2;
  • postal code;
  • city;
  • region; and
  • country.

Some addresses do not fit a local format, so avoid rules that assume every country uses the same order or postal-code pattern. If the final template combines fields, test blank optional lines so it does not leave large gaps.

Validate email addresses and phone numbers carefully

A simple email-format check can catch missing @ signs or spaces. It cannot prove that the mailbox exists or belongs to the right person.

Phone numbers are even more variable. Store a country code where the process needs international use. Avoid deleting leading + signs or zeroes through numeric formatting.

Treat contact validation as a reasonableness check, not proof of identity.

Validate repeating line items

Invoices, purchase orders, statements of work, and reports may contain a variable number of rows. Check both the item data and the link to its parent record.

For every item, validate:

  • parent document ID exists;
  • item sequence is present if order matters;
  • description is not blank;
  • quantity and price are numeric where required;
  • line total matches the rule;
  • tax or category is valid; and
  • the item is not duplicated unexpectedly.

Then check each parent:

  • it has at least one item when required;
  • item totals sum to the document total;
  • all items use the intended currency; and
  • item count stays within any operational limit.

Test the template with one item and enough items to cross a page.

Add a validation status and error message

Do not rely on several coloured cells. Create explicit output columns such as:

Validation_Status Validation_Errors
Ready
Error Missing Currency; duplicate Document_ID

Generate documents only from rows marked Ready. Keep the error message plain enough for the data owner to correct.

If several rules apply, combine messages or place them in a separate validation table. The important point is that errors remain visible and traceable.

Use spreadsheet features without hiding the rules

Excel and Google Sheets can support validation through:

  • data validation lists;
  • conditional formatting;
  • duplicate checks;
  • protected formula cells;
  • lookup tables;
  • filters; and
  • formulas that return a clear error message.

Conditional formatting is useful for attention, but the underlying status should still be stored as text. A red cell alone is difficult to audit and may not be accessible to every user.

Document formulas in a note or data dictionary. A complex formula understood by only one employee is an operational risk.

Run a preflight check against the Word template

Spreadsheet validation is incomplete if it ignores the template. Compare both directions:

  1. Every required Word placeholder has a source field.
  2. Every source field intended for output is used in the correct place.

Look for spelling differences such as ClientName versus Client_Name. Check that date and amount fields are mapped to the right placeholders.

For an overview of mapping and generation, read how to automate document generation from Excel.

Test edge cases with a small batch

Create a validation test set that includes:

  • the longest name;
  • a multi-line address;
  • an optional blank field;
  • a zero value;
  • a negative value if allowed;
  • the largest amount;
  • a date near month or year end;
  • special characters;
  • the largest item list; and
  • a deliberate invalid record.

The invalid record should not quietly produce a normal-looking file. Confirm that the workflow either blocks it or reports it clearly.

Open the generated documents and compare them with the source. Check formatting as well as values.

Keep review proportional to risk

Not every batch needs the same review. A set of internal name badges is different from a batch of contracts.

Define:

  • which documents require review of every file;
  • which can use sampling;
  • which fields always need a second check;
  • who can approve the batch; and
  • what evidence of review is retained.

For sampled review, include random records and all records with known edge conditions. Review should be a written process, not an assumption.

Generate only clean rows in TRYDOKU

Once the data is ready:

  1. Save or export the prepared table.
  2. Confirm that only Ready rows are included.
  3. Upload the Word template and supply the data in TRYDOKU.
  4. Review the field mapping.
  5. Generate a small sample.
  6. Compare values and layout.
  7. Generate the remaining batch after approval.

The document tool should be the final formatting step, not the first place data quality is checked.

TRYDOKU does not treat a column named Validation_Status as an automatic generation filter. Filter or export the sheet yourself so only Ready rows are imported. Keep the rejected rows in the working workbook with their error messages.

A reusable validation checklist

Before every batch, confirm:

  • header names are present and unique;
  • the expected number of rows is present;
  • required fields are complete;
  • identifiers remain text where needed;
  • dates are unambiguous and logically ordered;
  • numbers use the expected decimal rules;
  • currencies are explicit;
  • totals reconcile;
  • controlled values match their approved lists;
  • business keys and file names are unique;
  • repeating items link to the correct parent;
  • every required placeholder has a source field;
  • invalid rows are excluded; and
  • a representative sample has been reviewed.

Common mistakes

Fixing data only in a generated Word file

The source remains wrong, so the error returns in the next batch. Correct the source or record an approved exception, then regenerate.

Deleting duplicate rows without checking the business key

Two people may share a name. Use the proper document identifier or defined combination of fields.

Treating blank and zero as the same

Zero may be a valid price or quantity. Blank may mean missing. Preserve that distinction.

Trusting displayed dates

Inspect the stored value and locale rules. A familiar display can hide an incorrect interpretation.

Using a polished output as proof of accuracy

Formatting shows that the template worked. It does not prove that the data was correct.

Frequently asked questions

Can document software validate all spreadsheet data automatically?

It can detect some structural and mapping problems. Business rules such as approval, valid pricing, or acceptable dates must be defined by the organisation.

Should formulas or fixed values be supplied for totals?

Use an agreed source of truth. If formulas calculate totals, protect and test them. Supply the approved result to the document workflow.

Is conditional formatting enough to mark errors?

No. Add an explicit validation status or error message. Colour should support the message, not replace it.

What should happen to invalid rows?

Exclude them from generation and return them to the data owner with a clear reason. Do not silently insert blanks or defaults for important fields.

Make data quality part of the workflow

Reliable document generation begins with a prepared dataset, not a clever template. Define fields, use stable identifiers, test business rules, and make errors visible before a batch starts.

When the validation sheet is clean, you can create a TRYDOKU account and generate a small sample. Compare the output with the source, keep the review record appropriate to the document's risk, and only then continue with the full batch.

Explore more articles on spreadsheets & templates and document workflows.

Ready to automate your documents?

Connect your spreadsheet data to Word templates and start generating formatted documents in seconds. No credit card required.