blokboard/ Open app

Node reference

Work with files and CSV

Open a file, read its contents, turn rows into data, and save a useful result.

Files

A file reference is a handle to a file available during the current run. It contains details such as the name and size. The text inside the file becomes available when you use Read file.

Jump to a node: Open file · Read file · Parse CSV · Create file · Write file · Write CSV · Save file.

Choose your starting point#

Your taskNodes to connect
Read an existing text fileStart → Open file → Read file
Process an existing CSVStart → Open file → Read file → Parse CSV → Iterate
Build a text reportStart → Create file → Write file → Save file
Export records as CSVStart → Code → Write CSV → Save file

Open file and Save file require Desktop. The middle steps can also process temporary files in the Browser runtime. Try read and transform a CSV in the browser first; it creates its own sample file, so you need no local path.

Build a CSV report#

Use this small input to learn the whole path:

name,quantity,price
Notebook,2,5
Pen,3,2
  1. Connect Start → Create file. Name it orders.csv and paste the three lines above into Content.
  2. Connect Create file → Read file. In File, use the expression picker to select Create file’s output. Set Read mode to All lines in one execution.
  3. Connect Read file’s out → Parse CSV. Leave First row contains headers enabled. You now have two objects with name, quantity, and price fields.
  4. Connect Parse CSV → Code. Paste the script below to turn the numeric text into numbers and calculate each total.
  5. Connect Code → Write CSV. Name the result totals.csv and keep Add object headers enabled.
  6. In Desktop, connect Write CSV → Save file. Select Write CSV’s output in File and enter an absolute destination path on that machine. In the browser example, Read file shows the generated CSV as text instead.
return input.map(row => {
  const quantity = Number(row.quantity);
  const price = Number(row.price);
  return {
    name: row.name,
    total: quantity * price,
  };
});

The output contains Notebook,10 and Pen,6, with name,total as the header. Parse CSV keeps cell values as text; Number() is what makes the calculation numeric.

Understand file lifetime#

Create file and Write CSV make temporary files for the current run. Save or send them during that run if you need to keep their contents. Saving a file reference in State does not preserve the file bytes. There is no Close file node: the runtime releases its temporary file resources when the run ends.

When processing lines or rows, use the reader’s done output or Iterate’s done output for work that should happen after all item paths finish. Saving from an item path would save once per item.

The sections below explain each node’s settings and outputs.

Open file#

Open file makes an existing file on the Desktop machine available to this run. It returns a file reference; Read file is the next step when you need its contents.

Try it step by step#

  1. Choose the Desktop runtime and create a small orders.csv on that machine.
  2. Connect Start → Open file and enter its absolute path, such as /home/you/orders.csv or C:\Users\you\orders.csv.
  3. Connect Read file and select Open file’s output in its File field using the expression picker.

What to expect#

The output includes name, size, mediaType, and assetId. These describe the opened file; they are not the CSV rows.

Things to check#

  • The path belongs to the machine running Desktop, which may be different from the device displaying the browser.
  • If opening fails, check the path, file existence, and operating-system read permissions.
  • Use Create file to make new temporary content. Opened source files are not the writable temporary files used by Write file.

Runtime: This operation requires Desktop.

Parameters#

SettingDefaultWhat it does
File path(empty)Absolute path opened by Blokboard Desktop when this node runs.
On failurestopChoose whether a failed execution stops the workflow or only ends this path.
Retry attempts0How many additional attempts to make after the first failure.

On failure: Choices: Stop workflow (stop), Continue (continue). Available under More options.

Retry attempts: Available under More options. Limits: minimum 0.

Inputs#

PortValueDescription
inanyTrigger that opens the configured local file.

Outputs#

PortValueDescription
outfileReusable local file reference.

out fields#

FieldTypeDescription
assetIdstringInternal file reference.
namestringFile name.
mediaTypestringFile type.
sizenumberFile size in bytes.
lastModifiednumberLast changed time.
writablebooleanWhether this temporary file can be changed.
cursornumberCurrent write position in bytes.

Read file#

Read file turns a file reference into text. Choose one execution per line for line-based work, or all lines in one execution when the next step needs the complete document.

Try it step by step#

  1. Connect an Open file or Create file output to Read file and select that output in File.
  2. For the sample CSV above, choose All lines in one execution and connect out to Parse CSV.
  3. For a simple checklist, choose One line per execution. Put per-line work on out and the final summary on done.

What to expect#

All-lines mode emits one object containing text, lines, and lineCount. Line mode emits objects such as {"line":"Plan","lineNumber":1}. The done output waits for the downstream read paths to finish.

Things to check#

  • Read CSV as a whole document. Splitting it into lines first can break quoted fields that contain line breaks.
  • A file reference and a text value are different inputs. Use the reference in File.
  • If characters look wrong, choose the encoding used to create the file. UTF-8 is the default.

Parameters#

SettingDefaultWhat it does
File{{file.output}}Opened file to read.
Read modelineEmit one value per line, or one value containing the complete text.
Encodingutf-8Text encoding used to decode the file’s bytes. UTF-8 is the default.
On failurestopChoose whether a failed execution stops the workflow or only ends this path.
Retry attempts0How many additional attempts to make after the first failure.

Read mode: Choices: One line per execution (line), All lines in one execution (all).

Encoding: Choices: UTF-8 (utf-8), Windows-1252 (windows-1252), UTF-16 LE (utf-16le). Available under More options.

On failure: Choices: Stop workflow (stop), Continue (continue). Available under More options.

Retry attempts: Available under More options. Limits: minimum 0.

Inputs#

PortValueDescription
inanyTrigger or an opened file reference.

Outputs#

PortValueDescription
outanyOne line execution, or one execution containing all lines.
doneobjectEmitted after every read execution and its downstream path complete.

out fields#

FieldTypeDescription
linestringCurrent line.
lineNumbernumberCurrent line number, starting at 1.
linesarrayEvery line when Read mode is All lines.
textstringComplete text when Read mode is All lines.
lineCountnumberNumber of lines.

The out port can emit more than once. Each emitted value starts its connected path.

done fields#

FieldTypeDescription
lineCountnumberNumber of lines read.
filefileThe opened runtime file.

The done port waits for the descendant paths of out to finish.

Parse CSV#

Parse CSV converts CSV text into an array of rows. With headers enabled, each row is an object whose field names come from the first row.

Try it step by step#

  1. Connect Read file in all-lines mode to Parse CSV. You can also supply a plain text value or an object with a text field.
  2. For name,quantity followed by Notebook,2, leave First row contains headers enabled.
  3. Connect Parse CSV directly to Iterate with Items empty to process each row.

What to expect#

That two-line sample produces [{"name":"Notebook","quantity":"2"}]. Quantity is text. Without headers, the result is an array of row arrays.

Things to check#

  • Choose the delimiter explicitly if automatic detection reads the columns incorrectly.
  • Use Number(row.quantity) in Code before doing arithmetic.
  • Do not connect Open file directly to Parse CSV: read its text first.

Keep learning#

Parameters#

SettingDefaultWhat it does
DelimiterautoCharacter separating CSV columns. Choose the character used by the file.
First row contains headerstrueUse the first CSV row as object field names. When off, return arrays of cells.
Skip empty linestrueIgnore empty lines while parsing CSV rows.

Delimiter: Choices: Detect automatically (auto), Comma (,), Semicolon (;), Tab ( ), Pipe (|).

Skip empty lines: Available under More options.

Inputs#

PortValueDescription
instringCSV text produced by Read file.

Outputs#

PortValueDescription
outarrayCSV rows. Connect directly to Iterate to process one row at a time.

Create file#

Create file makes a writable temporary file in memory. Use it as the start of a text report or as a small sample input while learning.

Try it step by step#

  1. Connect Start → Create file. Set File name to notes.txt and Content to Hello.
  2. Connect Read file, select the Create file output, and choose All lines in one execution.
  3. Run and inspect the reader’s text field. Add Write file between these nodes to append more content.

What to expect#

Create file returns a file reference with writable: true. Read file returns text: "Hello". Creating a file does not save a copy to your disk.

Things to check#

  • The file lasts for this run. Use Save file in Desktop or send it as an attachment before the run ends.
  • If you plan to append separate lines, begin with empty content or include the required ending in the initial text. Write file appends at the end.

Keep learning#

Parameters#

SettingDefaultWhat it does
File nameoutput.txtName of the temporary file, including its extension.
Content(empty)Initial file contents. When empty, use incoming content if supplied.
Media typetext/plainContent type for the temporary file, such as text/plain or text/csv.
On failurestopChoose whether a failed execution stops the workflow or only ends this path.
Retry attempts0How many additional attempts to make after the first failure.

Media type: Available under More options.

On failure: Choices: Stop workflow (stop), Continue (continue). Available under More options.

Retry attempts: Available under More options. Limits: minimum 0.

Inputs#

PortValueDescription
inanyOptional content to place in the new memory file.

Outputs#

PortValueDescription
outfileFile available for the rest of this run.

out fields#

FieldTypeDescription
assetIdstringInternal file reference.
namestringFile name.
mediaTypestringFile type.
sizenumberFile size in bytes.
lastModifiednumberLast changed time.
writablebooleanWhether this temporary file can be changed.
cursornumberCurrent write position in bytes.

Write file#

Write file appends text to a temporary file created during this run. Each supplied line receives the chosen line ending.

Try it step by step#

  1. Create an empty notes.txt with Create file.
  2. Connect Write file. Select the created file in File and enter First line in Lines.
  3. Connect another Write file using the same file reference and enter Second line. Read the file in all-lines mode to inspect it.

What to expect#

The text contains First line and Second line on separate lines, with a final line ending. Write file returns the same file reference with an updated size and cursor.

Things to check#

  • Writing adds content; it does not replace earlier content. Start a fresh Create file when you want an empty report.
  • With Lines empty, the node can use incoming line, lines, text, or content data.
  • When writing from Iterate, save from done after the writing paths finish.

Parameters#

SettingDefaultWhat it does
File{{createdFile.output}}Temporary file to update.
Lines(empty)Lines to append. When empty, use the incoming line, lines, text, or content value.
New linelfAppend LF or Windows-style CRLF after each line written.
On failurestopChoose whether a failed execution stops the workflow or only ends this path.
Retry attempts0How many additional attempts to make after the first failure.

New line: Choices: LF (lf), CRLF (crlf). Available under More options.

On failure: Choices: Stop workflow (stop), Continue (continue). Available under More options.

Retry attempts: Available under More options. Limits: minimum 0.

Inputs#

PortValueDescription
inanyOne line or a list of lines to add.

Outputs#

PortValueDescription
outfileThe same temporary file with its cursor advanced.

out fields#

FieldTypeDescription
assetIdstringInternal file reference.
namestringFile name.
mediaTypestringFile type.
sizenumberFile size in bytes.
lastModifiednumberLast changed time.
writablebooleanWhether this temporary file can be changed.
cursornumberCurrent write position in bytes.

Write CSV#

Write CSV turns row data into a temporary CSV file. It handles delimiters and quoting so you do not have to assemble CSV text yourself.

Try it step by step#

  1. Connect a Code node returning [{name:"Notebook",total:10},{name:"Pen",total:6}] to Write CSV.
  2. Set File name to totals.csv and keep Add object headers enabled.
  3. Connect Read file in all-lines mode to inspect the CSV, or Save file in Desktop to keep it on disk.

What to expect#

The CSV begins with name,total and contains Notebook,10 and Pen,6. The node’s output is a file reference, so use Read file to inspect the actual text.

Things to check#

  • You can supply an array, an object with a rows array, or one row object.
  • Keep Protect spreadsheet formulas enabled when exporting text that came from other people. It protects formula-like cells when opened in spreadsheet software.
  • Write CSV creates a new file each time it executes. Collect your rows first if you want one report.

Keep learning#

Parameters#

SettingDefaultWhat it does
File nameoutput.csvName of the generated CSV file, such as totals.csv.
Delimiter,Character separating CSV columns. Choose the character used by the file.
Add object headerstrueWrite object field names as the first CSV row.
Protect spreadsheet formulastruePrefix formula-like text cells so spreadsheet software does not treat them as formulas.
On failurestopChoose whether a failed execution stops the workflow or only ends this path.
Retry attempts0How many additional attempts to make after the first failure.

Delimiter: Choices: Comma (,), Semicolon (;), Tab ( ), Pipe (|).

Protect spreadsheet formulas: Available under More options.

On failure: Choices: Stop workflow (stop), Continue (continue). Available under More options.

Retry attempts: Available under More options. Limits: minimum 0.

Inputs#

PortValueDescription
inanyOne row or a list of rows to convert to CSV.

Outputs#

PortValueDescription
outfileCSV file available for the rest of this run.

out fields#

FieldTypeDescription
assetIdstringInternal file reference.
namestringFile name.
mediaTypestringFile type.
sizenumberFile size in bytes.
lastModifiednumberLast changed time.
writablebooleanWhether this temporary file can be changed.
cursornumberCurrent write position in bytes.

Save file#

Save file writes a temporary file to a path on the Desktop machine. Use it after the final write or CSV conversion.

Try it step by step#

  1. Connect Create file, Write file, or Write CSV to Save file.
  2. Select that node’s file output in File. Enter an absolute Destination path such as /home/you/totals.csv.
  3. Run in Desktop and open the saved file on that machine to check its contents.

What to expect#

The file contents are written to the destination. The node returns the file reference so the path can continue.

Things to check#

  • Choose an output path you intend to write. Check the Desktop machine’s directory and write permissions when a save fails.
  • Saving on a per-item path writes repeatedly. Connect from the reader’s or iterator’s done path to save after processing.
  • Saving workflow JSON does not save temporary file contents.

Runtime: This operation requires Desktop.

Parameters#

SettingDefaultWhat it does
File{{createdFile.output}}Temporary file to save.
Destination path(empty)Absolute path written by Blokboard Desktop when this node runs.
On failurestopChoose whether a failed execution stops the workflow or only ends this path.
Retry attempts0How many additional attempts to make after the first failure.

On failure: Choices: Stop workflow (stop), Continue (continue). Available under More options.

Retry attempts: Available under More options. Limits: minimum 0.

Inputs#

PortValueDescription
inanyTrigger or a temporary file reference.

Outputs#

PortValueDescription
outfileThe temporary file after it has been saved.

out fields#

FieldTypeDescription
assetIdstringInternal file reference.
namestringFile name.
mediaTypestringFile type.
sizenumberFile size in bytes.
lastModifiednumberLast changed time.
writablebooleanWhether this temporary file can be changed.
cursornumberCurrent write position in bytes.