Database Sample Excel: Build a Test Data Sheet
In this article
A database sample in Excel is a spreadsheet you build first, so you can design and test a database's tables, fields and relationships before entering real records. The shortest working method is: plan the fields you need as column headers, give every table its own sheet with one header row, add a primary key column, enter a handful of realistic rows, then import or link that sheet into your database tool. That order catches design mistakes on a handful of rows instead of thousands, and it gives you something to show colleagues without exposing live data. Below is the full sequence, plus the mistakes that most often break an import.
What You'll Need
- A spreadsheet app: Microsoft Excel, LibreOffice Calc, or Google Sheets. Excel is used for the wording below, but the steps are the same everywhere.
- A clear idea of what the database is for, in one sentence. If you cannot write the sentence, the sample will drift.
- A list of the things you want to store: for example customers, orders and products. Each one becomes a sheet and later a table.
- Your destination database or import tool, if you intend to load the sample straight in. That can be Access, MySQL, SQL Server, PostgreSQL, Airtable, or a low-code app such as Power Apps. Labels in those tools vary by version, so treat any menu name below as a guide.
- Enough sample rows to test edge cases: blank optional fields, a long text value, a date at the end of a month, and a record with a customer who has no orders. Five to ten rows per sheet is usually enough.
Step-by-Step
- Write the one-sentence purpose. Put it in a cell on a separate sheet, or as the file name. Something like "track repair jobs per customer, with status and cost". Everything later should serve that sentence.
- List your entities as bullet points. Under the sentence, note the nouns: customers, jobs, parts, technicians. Each noun that has its own attributes becomes a sheet. Nouns that only describe another noun, like a status value, become a lookup list rather than a sheet.
- Create one sheet per entity. Rename the tabs to match the entities and keep the names short and without spaces, such as Customers, Jobs, Parts. Databases dislike spaces and punctuation in table names, and doing this now avoids renaming later.
- Put field names in row 1 and nothing above it. No merged title cell, no logo row, no blank row. Import tools read the first row as column headers, and a title row shifts everything by one and breaks the mapping.
- Name each column like a database field. Use letters, digits and underscores only, start with a letter, and avoid spaces. CustomerID is safe; Customer ID is not, and neither is Cost ($). Put units in the sheet name or a note, not in the header.
- Add a primary key to each sheet. The first column should be a unique identifier: CustomerID, JobID, PartID. Use consistent values, not random text, and never leave a key blank. If you plan to let the database generate keys, still make the column now so the structure is complete.
- Choose data types per column and stick to them. Decide now whether each column is text, whole number, decimal, date or yes/no. In Excel, set the number format accordingly and check that no column mixes values like "12" and "twelve". Mixed types are the single biggest cause of failed imports.
- Enter only one piece of information per column. Split a full name into FirstName and LastName, a full address into Street, City and Postcode, and a phone field into a single number only. One value per cell is what lets the database sort, filter and join reliably.
- Enter five to ten realistic rows per sheet. Use plausible values, not abc or 123, because real-looking values expose length and format problems. Include a deliberately awkward value: a long product description, an accented name, a date such as 31 January, and a blank optional field.
- Link the sheets with a matching key column. In Jobs, add a CustomerID column that holds values from the Customers sheet. That pair of columns is the relationship. Do not repeat the customer's name in Jobs; refer to the customer by key only.
- Add lookup sheets for fixed lists. Status values, categories and titles go on a small sheet with one column of allowed values. These become validation lists or reference tables later. Keep the wording consistent, including capitals: Completed and completed are two different values to a database.
- Format as a table with a filter row. Select the data on a sheet and use Insert > Table. This makes headers obvious, lets you sort and filter, and helps you spot duplicates and blanks. Note that merged cells must go before this step, because tables cannot contain them.
- Validate the sample before importing. Filter each key column for blanks, sort each date column to check for text masquerading as dates, and look for rows where a foreign key has no matching parent record. Fix everything now; the same errors are far harder to trace after import.
- Import or link it and test. In your database tool, use its import or link command and map each column to the matching field. Import parent tables first (Customers, then Jobs), so keys exist when child rows arrive. Once loaded, run one join or filter from each table to confirm the relationships behave as expected.
- Save a clean copy as the template. Keep the empty structure with headers and validation, plus a filled version for demos. Future samples then start from a known-good file instead of a copy full of stale rows.
Common Mistakes
A title row above the headers. The importer reads "Customer list" as a column name and shifts every mapping. Delete titles and keep headers in row 1.
Merged cells and multi-line cells. Merged cells break table features and confuse imports; a cell containing several values separated by commas cannot be searched properly. One value, one cell.
Missing or duplicated keys. Blank keys, or the same ID used twice, make relationships impossible to build and produce duplicate records after import.
Mixed data types in one column. A column with both dates and text, or numbers stored as text, will either fail to import or import as the wrong type. Check with the sort trick above.
Repeating data instead of using keys. Copying the customer's address into every job row means updating it in many places. Store it once and reference it.
Using real personal data. A sample should use invented names, phone numbers and addresses. If real data is unavoidable, keep it out of shared copies and check what your organisation's data rules allow, since privacy rules differ by country.
Tips
Keep a small "notes" sheet in the same file listing the fields, their intended types and any business rules, such as "a job must have a customer". It costs a minute and answers most questions later.
Use consistent date formatting throughout, ideally a format that reads the same in every region. Ambiguous dates such as 03/04 are a classic source of errors when files travel between countries.
Give every sheet the same few conventions: key column first on the left, fixed lists on their own sheet, and no totals or summary rows mixed into the data. Summary rows are not records and will import as blank or wrong values.
Delete the rows you added for edge-case testing before you share the file as a starter template, but keep one copy of them for import testing.
Troubleshooting
If rows import as blank, check for trailing blank rows and hidden columns in the sheet; some tools read them as data.
If dates arrive as text or the wrong dates, confirm the column's format and that no value has a trailing space or an apostrophe in front of it.
If numbers gain decimals or lose leading zeros, the column type in the destination is wrong; postcodes and phone numbers should be text, not numbers.
If a foreign key does not match, compare the two columns for stray spaces and inconsistent capitals, then import the parent table first.
If records are duplicated, the key column was not unique or was left out of the import mapping. Remove the duplicates, correct the keys, and re-import into an empty table rather than on top of the existing one.
Frequently Asked Questions
Can I use Google Sheets instead of Excel?
Yes. The structure matters more than the app: headers in row 1, one value per cell, consistent types and unique keys. Sheets can export to a compatible spreadsheet file for import.
How many rows do I need in a sample?
Usually five to ten per table is enough to test relationships and formatting. The goal is coverage of edge cases, not volume.
Should the sample contain real data?
Preferably not. Invented names and contact details keep the sample safe to share and avoid privacy obligations.
Can Excel itself enforce relationships between sheets?
Only loosely, through validation lists and lookup formulas. Enforced relationships, uniqueness and types belong in the database you import into.
What if I need to change a field later?
Update the header and all rows in the sample, then re-import into an empty table. Changing field names after real data exists is a separate migration step.