Prep Kit

Guide · Organizing work

Setting Up Files and Folders for Data Analysis and SQL Work

The structure you pick on day one decides how painful day thirty is

By , Implementation Analyst · Published

By the end of this page you can set up a project folder that keeps original data safe, shape a spreadsheet so it loads into SQL as clean tables, name things so you can find them in six months, and rebuild your database from scratch in a few minutes. It is about twenty minutes, and nothing here needs more than a file explorer, a text editor and a SQL tool such as DB Browser for SQLite.

Here is what to do today, before moving any file. Make one empty folder for the project and write one sentence in a text file inside it: what question this folder exists to answer. If you cannot write the sentence, you are not ready to organise anything yet, and no folder structure will fix that.

The short version: keep the original data untouched, make every sheet a clean table, treat the database as something you can delete and rebuild, and save every query as a file. Everything else on this page is detail on those four.

What you’ll learn
  1. One project, one folder
  2. The structure
  3. Raw data is read-only
  4. One sheet, one table
  5. Names: files, tabs and columns
  6. Getting a workbook into SQLite
  7. Your SQL lives in files
  8. The README
  9. The full before and after
  10. Edge cases worth knowing
  11. Why this works
  12. Using this on your own project
  13. The whole thing on one screen

1. One project, one folder

A project is whatever one question needs: the data, the queries, the outputs. Put all of it under a single folder, and use paths that start from that folder, so the whole thing can be moved, zipped or shared without anything breaking.

Avoid the two common failures. One is a single folder called Data that holds every project you have ever done. The other is files scattered across Downloads, Desktop and a USB stick, which feels fine until you need the version from three weeks ago.

2. The structure

This is a sensible default for SQL practice or small analysis work. Start with this and delete what you do not use.

personal_tracking/
├── README.md
├── data/
│   ├── raw/          original files, never edited
│   └── processed/    cleaned CSVs, one per table
├── db/
│   └── tracking.db   rebuildable, safe to delete
├── sql/
│   ├── schema/       CREATE TABLE statements
│   └── queries/      your saved analysis queries
└── outputs/          exports, charts, reports

Each folder answers one question: where did this come from? raw is the source. processed is what you changed. db is what you built from it. sql is how you built and questioned it. outputs is what you produced. If you can answer that for any file, you know where it belongs.

If you also write Python, add a scripts/ folder next to sql/. Do not add it just in case.

3. Raw data is read-only

The first rule, and the one that saves the most grief: the file in data/raw/ is never edited, renamed or re-saved. Not to fix a typo, not to delete a column, not to “just tidy it up”. Copy it out, and work on the copy.

The reason is simple. Once you edit the original, you can no longer tell what you changed, and you cannot rerun the work if the source updates. A raw file you never touch is also your proof of what you started with.

If the workbook is one you update every week, as in a tracker, keep the live version wherever you normally edit it and drop a dated copy into raw each time you want to analyse it, for example personal_tracking_2026-10-23.xlsx. The dated name is what tells you which version a result came from.

4. One sheet, one table

A SQL table is a rectangle: one header row, then one row per thing, nothing else. A worksheet that follows that rule loads cleanly. One that does not will fight you at every step.

Keeping unrelated data on separate tabs is exactly right. A tab for platforms, a tab for applications and a tab for earnings are three tables, and SQL can join them later. The work is making each tab a proper rectangle.

RuleWhy SQL cares
Headers in row 1, nothing above themThe importer reads row 1 as column names. A title row becomes your column names.
One row per record, no blank rowsA blank row becomes a row of NULLs.
No merged cellsOnly the top-left cell holds a value. The rest load as empty.
One value per cell“Python, SQL” in one cell cannot be filtered, counted or joined.
One type per columnA column mixing numbers and “n/a” loads as text.
No totals or notes inside the dataA total row gets counted as a record and doubles every sum.
A key column that identifies each rowIt is what you join on. Without it, tabs cannot be linked reliably.
Dates as YYYY-MM-DDIt sorts correctly as text, and SQLite’s date functions understand it.

Keep summaries, charts and notes on their own tab, and do not import that tab. Then the data tabs stay clean and you still get your dashboard.

5. Names: files, tabs and columns

Pick one convention and use it everywhere. The one that costs you least in SQL is lowercase words joined by underscores: no spaces, no capitals, no punctuation.

ThingPainfulBetter
TabEarnings Logearnings_log
ColumnTime Spent(minutes)time_spent_minutes
Raw filetracking final v2 (1).xlsxtracking_2026-10-23.xlsx
Query filequery new.sqlearnings_by_platform.sql

The reason is practical. A column named Time Spent(minutes) has to be wrapped in brackets or quotes in every query you ever write about it, and one missed bracket is an error. A column named time_spent_minutes needs nothing. Put the unit in the name when there is one, because a number without a unit is a guess.

For files, put the date first when order matters (2026-10-23_export.csv) so a folder listing sorts itself. Never use “final”, “new” or “v2” as a name. If you need versions, use dates.

6. Getting a workbook into SQLite

Be clear about one limit first. DB Browser for SQLite does not read an .xlsx file directly. It imports CSV, and a CSV holds one sheet. So a workbook with four tabs means four CSV files, and the database is a copy of the workbook as it was when you exported, not a live view of it.

That is fine, as long as you treat the database as disposable. The routine for each refresh:

  1. Copy the current workbook into data/raw/ with today’s date.
  2. Export each data tab as CSV into data/processed/, one file per tab, named after the table: earnings_log.csv.
  3. Delete db/tracking.db and create a fresh one.
  4. In DB Browser: File → Import → Table from CSV file. Tick “Column names in first line”, check the delimiter is a comma, and check the table name.
  5. Open Browse Data on each table and look at the first rows. Then click Write Changes.

Step five is the one people skip. Look at the row count against the sheet, and look at one date column and one ID column, because those are where imports quietly go wrong (see the edge cases below).

If this routine is too heavy for data you refresh weekly, that is the moment a small script is worth it. It is a separate decision from learning SQL, and you can make it later. For practice, the manual routine teaches you what the script would hide.

7. Your SQL lives in files

A query typed into the window and closed is a query you have to rewrite. Save every query that mattered as a .sql file in sql/queries/, one purpose per file, named for what it answers.

-- earnings_by_platform.sql
-- Question: which platform earns the most per hour?
-- Tables:   earnings_log
-- Written:  2026-10-23

SELECT platform,
       SUM(earnings)                 AS total_earned,
       SUM(time_spent_minutes) / 60.0 AS total_hours
FROM earnings_log
GROUP BY platform
ORDER BY total_earned DESC;

The four comment lines are the habit. They answer the question you will have in a month: what was this for, and what does it read from? Use 60.0 rather than 60 when you divide, because SQLite divides two whole numbers as whole numbers and drops the decimals.

Put the CREATE TABLE statements in sql/schema/, numbered in the order they run: 01_create_tables.sql. Together with your CSVs, that is enough to rebuild the whole database from nothing, which is the real test of a good setup.

8. The README

One short text file at the top of the project, written for you in six months. It needs five lines, no more.

# personal_tracking
Question: how much do I earn per hour on each platform?
Source: data/raw/personal_tracking_2026-10-23.xlsx (copy of live tracker)
Rebuild: export each tab to data/processed/, import into db/tracking.db
Tables: platform_info, applications, earnings_log
Known issues: some earnings blank where payout is pending

The last line matters most. It is where you write down what you know is wrong with the data, so a number you quote later comes with its limits attached.

The full before and after

Same project, same data, one month apart.

Before

Desktop/
├── Personal Tracking.xlsx
├── Personal Tracking (1).xlsx
├── Personal Tracking FINAL.xlsx
├── earnings.csv
├── tracking.db
└── query new.sql

Three workbooks and no way to tell which one the database came from. A CSV with no date, a query with no name, and nothing recording what any of it was for.

After

personal_tracking/
├── README.md
├── data/raw/personal_tracking_2026-10-23.xlsx
├── data/processed/earnings_log.csv
├── db/tracking.db
├── sql/schema/01_create_tables.sql
└── sql/queries/earnings_by_platform.sql

One source file with a date on it, one cleaned copy per table, a database you can delete and rebuild, and a query that says what it answers. Nothing about the data changed. What changed is that you can now trust where each file came from.

Edge cases worth knowing

Six that come up.

IDs lose their leading zeros. An ID like 00417 is text that looks like a number, and Excel or an importer can turn it into 417. If an ID has leading zeros, make sure the import treats that column as text, and check one row after loading.

Dates export in the wrong shape. A cell can display as 10/23/26 and export in a regional format that SQL cannot sort. Format date columns as YYYY-MM-DD in the sheet before exporting.

Commas and line breaks inside text. A note such as “paid late, follow up” sits inside quotes in a CSV, which is normal. If the row count after import is higher than in the sheet, a line break inside a cell is the usual cause.

The importer guesses types. It looks at the data and decides each column is a number or text. One stray “n/a” in a numeric column can turn the whole column to text, and then SUM misbehaves. Check the column types after import.

Blank is not zero. An empty cell can load as an empty string rather than NULL, and the two behave differently in WHERE and COUNT. Decide which you mean, and fix it once at load time rather than in every query.

Cloud-synced folders and open files. Keeping the project in a synced folder is fine for backup, but do not keep the .db file open in two places at once. Two programs writing to the same database file is how it gets corrupted.

Why this works

None of this is personal taste. It is close to what people who study research workflows recommend. A widely cited set of practices for scientific computing tells people to keep raw data separate from derived data, to treat the raw copy as something you never change, and to give each project its own folder with a consistent layout (Wilson et al., 2017, PLOS Computational Biology, 13(6), e1005510). The aim is that someone else, including you later, can tell what each file is and rerun the work.

The rules for the sheet itself come from the same place. A well-known paper on spreadsheet organisation argues for consistent codes, one value per cell, a single rectangular table per sheet, no empty cells used as formatting, and keeping raw data separate from calculations (Broman & Woo, 2018, The American Statistician, 72(1), 2–10). A table that follows those rules is, nearly by definition, a table SQL can load.

One note on the cheat sheet below. It is built to be covered and recalled rather than reread, because reviews of study techniques put practice testing and spacing near the top of what works and rereading and highlighting near the bottom, despite rereading feeling much more productive (Dunlosky, Rawson, Marsh, Nathan, & Willingham, 2013, Psychological Science in the Public Interest, 14(1), 4–58).

Using this on your own project

Do this once, in order. It is about fifteen minutes the first time.

  1. Write the question. One sentence, at the top of a new README.
  2. Create the folders. data/raw, data/processed, db, sql/queries, outputs.
  3. Copy, do not move, your workbook into data/raw and add today’s date to the name.
  4. Check each tab against the table rules. Header in row 1, no merged cells, one value per cell, dates as YYYY-MM-DD.
  5. Rename tabs and columns in your working copy to lowercase with underscores.
  6. Export one CSV per tab into data/processed, then import each into a fresh database in db.
  7. Check the import. Row count against the sheet, one date column, one ID column.
  8. Save your first query as a .sql file with the four comment lines.

If you have paper nearby, one optional sketch is worth five minutes. Draw your tabs as boxes, write the key column in each, and draw a line between any two boxes that share one. That picture is your table relationships, and the boxes with no line are the tabs that are not related, which you can leave out of the database.

The whole thing on one screen

This is the retrieval sheet. Cover the right column, work down the left, and say each answer out loud before you check it.

ThingWhat to remember
One folderOne project, one folder, paths relative to it.
data/rawOriginals. Never edited, renamed or re-saved.
data/processedCleaned CSVs, one per table.
dbRebuildable. Safe to delete.
sql/schemaNumbered CREATE TABLE files.
sql/queriesOne purpose per file, named for the question.
Sheet = tableHeader in row 1, one row per record, no merges, no totals.
CellOne value, one type per column.
Key columnWhat you join on. Every table needs one.
DatesYYYY-MM-DD.
Nameslowercase_with_underscores, unit in the name.
VersionsDates in the name, never “final” or “v2”.
DB BrowserImports CSV, one sheet at a time. Not live.
After importCheck row count, a date column, an ID column.
Query headerQuestion, tables, date. Four comment lines.
READMEQuestion, source, rebuild steps, known issues.
The one habit to keep. Be able to delete the database and rebuild it from files in a few minutes. If you can, everything upstream of it is in order. If you cannot, something is living only in your head or only in a window you closed, and that is the thing to fix first.

One last thought, and I would genuinely like other people’s answers. What is the worst file name you have ever had to work with, and what did it cost you to work out what was inside?

References

Related guides and kits6 links
All guides