EXAMPLE 06 OF 16 · Starter
Read and transform a CSV
Create a sample CSV, read its rows, calculate totals, and inspect a new CSV. Everything runs locally in the browser.
Before you begin#
- Use the Browser runtime. The workflow creates its own temporary file, so you need no local path, uploaded file, or credentials.
Walk through the workflow#
- Create file makes orders.csv from three lines of sample text. Inspect its Content field before running.
- Read file reads the entire file once. Parse CSV uses its text and treats the first row as column names.
- Code converts quantity and price from text to numbers, then returns one total per row.
- Write CSV creates totals.csv. The last Read file shows the generated CSV text while the temporary file is still available.
- Run once and inspect the final text: name,total followed by Notebook,10 and Pen,6.
Follow the data#
| Step | What the next node receives |
|---|---|
| Create file | A temporary file reference |
| Read file | An object containing the complete CSV text |
| Parse CSV | An array of objects with text-valued cells |
| Code | An array with name and numeric total fields |
| Write CSV | A new temporary file reference |
| Final Read file | The generated CSV text |
Check your result#
name,total
Notebook,10
Pen,6The important distinction is between a file reference, text, and row data. Each step turns one form into the next.
Make one change#
Add Folder,4,3 as a new line in Create file’s Content. Expect Folder,12 in the result. Read file must stay in all-lines mode so Parse CSV receives the full header and all rows together.
Save it on your device#
Choose Desktop and connect Save file after Write CSV. Select Write CSV’s output in File and enter an absolute destination path on the Desktop machine. The browser example deliberately ends by reading the generated text.
If it does not match#
If Parse CSV says it needs text, check that it follows Read file rather than Create file. If only one row is processed, check the reader’s mode. A temporary file reference from an earlier run cannot be reused: create or open the file again in the current run. See the complete Files guide.