# Save the records to files

> Deepgram workshops › Field inspection logger workshop › Save the records to files
> Web version: https://workshops.deepgram.com/events/field-inspection-logger/save-the-record

### Get ready for step 7 {#first-step}

**Goal:** Save the finished inspection records with one button, and open the two files the app writes.

We're building a web page that listens to you talk and writes your inspection report for you.

**Step 7 of 7.** Done: steps 1 to 6. Now: step 7, save the record. Still to come: none, this is the last step.

**So far:** a recording that plays through the page and gets a score.

**In this step, you'll:**

- Save the finished inspection records with one button.
- Open the two files the app writes.

Both files go in the `inspections` folder inside the project folder, named for today's date. The JSON (JavaScript Object Notation) file keeps each value next to its name, which suits programs. The CSV file has one line per record with commas between the values, and a spreadsheet app can open it.

**Switch to this step.** Skip this if the label at the top of the page already names step 7. This step changes the server, so restarting the app matters.

- **Codespace or your own computer.** In the app terminal, press Ctrl+C. Run `npm run step 7`, then `npm start`.
- **Docker.** In your second terminal, run `docker compose run --rm app npm run step 7`. Wait about 10 seconds.

The terminal prints `You are on step 7: Save the record.` If the page looks stuck after you switch, [restart the app](/events/field-inspection-logger/setup#if-something-looks-wrong) and reload the page.

### Save the day's records {#save}

1. Reload the page. The label at the top names step 7.
2. Check that the **Mode** menu shows the Hands-free option, as in step 5. Click **Start talking**, say two inspections as in step 5, and wait after each one. Click **Stop**. You'll see two rows in **Completed inspections**, and the button below them says **Save 2 records**.
3. Click **Save 2 records**. You'll see `Saved 2 records.` and the names of the two files, with today's date. The button goes back to **Save records** and turns grey.
4. Open the `inspections` folder. In a Codespace, click it in the file list on the left. On a Mac, run `open inspections` in your [second terminal](/events/field-inspection-logger/setup#check-that-it-works). On Windows, run `explorer inspections` instead.
5. Open the `.csv` file in Excel, Numbers, or Google Sheets. In a Codespace, right-click the `.csv` file in the file list and download it first. You'll see one row per record, with the columns `id`, `condition`, `severity`, `note`, and `saved_at`.

The sample clip works too, and gives more rows. In Docker or a Codespace, the date in the file names follows UTC, so a save late in the day in the US can carry the next day's date. Saving again the same day adds the new records to the same two files.

**You should see:** the page says the records were saved, with the two file names, and the `.csv` file opens in your spreadsheet app. If you don't, use the fixes below.

### Fix what looks wrong {#if-something-looks-wrong}

- **The save button stays grey.** No record is finished yet. Use Hands-free mode or the sample clip, and wait for a row in the table.
- **Saving fails with "Not found" or "JSON" in the message.** The app is still running the code from the step before. Restart the app and reload the page. Get a new record, then save. See [Save fails after switching steps](https://github.com/deepgram-devs/field-inspection-logger-workshop/blob/main/docs/troubleshooting.md#save-fails-after-switching-steps).

Reloading the page or playing the clip empties the table, so save the rows you want to keep first. For anything else, find what you see in the [Start here](https://github.com/deepgram-devs/field-inspection-logger-workshop/blob/main/docs/troubleshooting.md#start-here) table. Never paste your key.

### See why it works (optional) {#under-the-hood}

A web page isn't allowed to create files on your computer. So the page sends the records to the server at `/api/save`, and the server writes the files. The server accepts records only from the app's own page.

To see exactly what a step changed, run `git diff origin/step-6 origin/step-7`, or `docker compose run --rm app git diff origin/step-6 origin/step-7` with Docker. Press Q to leave the list.

### Take the kit home {#take-it-home}

The kit is yours to keep. Every step stays on its branch, so you can go back to any of them with `npm run step N`. To build the steps yourself, see [Build it with your coding agent](https://github.com/deepgram-devs/field-inspection-logger-workshop/blob/main/docs/coding-agent.md). The kit's [step 7 page](https://github.com/deepgram-devs/field-inspection-logger-workshop/blob/main/docs/step-7.md) shows what the files look like.
