AI Prompt to Build a Data Dictionary From a Spreadsheet or Database Table
This data dictionary prompt asks ChatGPT, Claude, or Gemini to turn a raw spreadsheet or database table into a clear reference document: every column named, typed, described, and flagged for quirks like nulls or inconsistent formats. It's built for analysts, data engineers, and anyone handing a dataset off to someone else who shouldn't have to guess what "flag_2" means.
Instead of just describing a table in prose, the prompt pushes the model to infer the likely data type, note which columns look like keys or foreign keys, call out columns with mixed formats or suspicious values, and produce the result as a clean, consistent table rather than scattered notes. That structure is what makes a data dictionary actually usable by the next person who opens the file.
Because the output needs to stay in a strict, repeatable table format across runs, it helps to lock down that structure in the prompt itself. Running the template through Cuelara's Prompt Formatter first can convert the loose instructions below into a stricter Markdown or JSON schema the model follows exactly, every time.
Prompt template
Want it sharper? Optimize this prompt with Prompt Optimizer, check it with the Prompt Debugger or shorten it with the Token Optimizer.
Example input
When to use it
- You're handing a dataset off to another team or a new hire and don't want to field column-meaning questions one by one.
- You inherited a spreadsheet or database table with no documentation and need to understand it before building on it.
- You're preparing data for a BI tool or dashboard and need a reference for what each field actually represents.
- You're auditing a table before a migration and need to know which columns are safe to drop versus load-bearing.
Best practices
- Paste in actual sample rows, not just column headers, so the model can infer types and flag format inconsistencies instead of guessing.
- Ask the model to explicitly mark columns it's unsure about, rather than confidently describing a field it can't actually verify.
- Request the output as a single table with fixed columns (name, type, description, notes) so multiple dictionaries stay easy to compare.
- Have the model call out likely primary keys, foreign keys, and duplicate-looking columns separately from the main description.
Common mistakes
- Giving the model only column names with no sample data, which forces it to guess meaning instead of inferring it from real values.
- Letting the model state data types and descriptions as fact when the sample is too small to actually confirm them.
- Skipping a note on units and formats (currency, timezone, date format), which is exactly what causes downstream analysis errors.
- Treating the generated dictionary as final without a human reviewing the columns the model flagged as uncertain.
FAQs
What's the difference between a data dictionary and a data catalog?
A data dictionary describes the columns and structure of a single table or dataset — names, types, meanings. A data catalog is broader: it indexes many datasets across a company, including where they live and who owns them. This prompt is built for the single-table case.
Can ChatGPT actually infer data types accurately from a small sample?
It can make reasonable inferences from a sample of 10-20 rows, especially for obvious types like dates or integers, but it can't guarantee correctness for the full dataset. That's why the prompt asks for a confidence level on each column instead of presenting every description as certain.
How often should I regenerate a data dictionary for a table that changes often?
Regenerate it whenever the schema changes (columns added, removed, or repurposed) or when you notice the existing dictionary no longer matches what's actually in the data — treat it as documentation that goes stale, not a one-time artifact.
What tool pairs well with this data dictionary prompt?
Prompt Formatter — it's built for exactly this kind of structured-output request, converting the loose instructions into a strict Markdown or JSON template so the model's table format stays identical every time you run it.