SpreadSheet for LiaScript: Excel-Style Interactive Tables in Your Course

SpreadSheet for LiaScript: Excel-Style Interactive Tables in Your Course

Interactive data tables are a staple of business, science, and data literacy education. The SpreadSheet template brings JSSpreadsheet (jspreadsheet.js) into LiaScript, enabling student-editable tables with Excel-style formulas, dropdown selectors, checkboxes, sorting, search, and persistence — all without a server.


Quick Start

<!--
import: https://raw.githubusercontent.com/LiaTemplates/SpreadSheet/refs/heads/main/README.md
-->

Macro: @spreadsheet (in fence header)

Place @spreadsheet in the header of a JSON code block. The JSON block defines worksheets, column types, and data.

```json @spreadsheet
{
  "worksheets": [{
    "data": [
      ["Task", "Owner", "Done?"],
      ["Write course", "You", true],
      ["Review draft", "Me", false]
    ],
    "columns": [
      { "type": "text",     "title": "Task",  "width": 200 },
      { "type": "dropdown", "title": "Owner", "source": ["You","Me","Both"] },
      { "type": "checkbox", "title": "Done?" }
    ],
    "worksheetName": "Project Tracker"
  }]
}
```

Try it live — edit cells, toggle checkboxes, and select owners from the dropdown:


Column Types

TypeDescription
"text"Free text input
"numeric"Number input (right-aligned)
"dropdown"Select from list (use "source": [...])
"checkbox"Boolean toggle
"calendar"Date picker
"image"Image URL cell
"color"Color picker

Excel Formulas

JSSpreadsheet supports Excel-style formulas. Write formulas as cell content in "data":

```json @spreadsheet
{
  "worksheets": [{
    "data": [
      ["Q1", "Q2", "Q3", "Q4", "Total"],
      [1200, 1400, 900, 1600, "=SUM(A2:D2)"],
      [800, 1100, 750, 1300, "=SUM(A3:D3)"],
      ["=SUM(A2:A3)", "=SUM(B2:B3)", "=SUM(C2:C3)", "=SUM(D2:D3)", "=SUM(E2:E3)"]
    ],
    "columns": [
      { "type": "numeric", "title": "Q1" },
      { "type": "numeric", "title": "Q2" },
      { "type": "numeric", "title": "Q3" },
      { "type": "numeric", "title": "Q4" },
      { "type": "numeric", "title": "Total" }
    ],
    "worksheetName": "Sales Data"
  }]
}
```

Try it live — edit the quarterly numbers and watch the SUM formulas update automatically:


Multiple Worksheets

Add more objects to the "worksheets" array:

```json @spreadsheet
{
  "worksheets": [
    {
      "data": [["Name","Score"],[" Alice",95],["Bob",82]],
      "columns": [{"type":"text","title":"Name"},{"type":"numeric","title":"Score"}],
      "worksheetName": "Class A"
    },
    {
      "data": [["Name","Score"],[" Carol",88],["Dave",76]],
      "columns": [{"type":"text","title":"Name"},{"type":"numeric","title":"Score"}],
      "worksheetName": "Class B"
    }
  ]
}
```

Persistence

Add persistent: true to the LiaScript slide header to save student edits:

# My Sheet
<!-- persistent: true -->

@spreadsheet

The data is stored in localStorage and restored on the next visit.


Full Template Demo


Use Cases

Data literacy and statistics — Students enter and calculate with real datasets using familiar spreadsheet interaction. Formulas make the calculations transparent and editable.

Business and economics courses — Budget simulations, break-even analysis, and financial modeling without needing Excel.

Science labs — Enter measurement results in a structured table; formulas compute averages, standard deviation, and error margins.

Project management training — Use checkbox and dropdown columns for task assignment and status tracking exercises.

Language and humanities — Use text columns for vocabulary tables, grammar tables, and annotation matrices.


Technical Facts

Runs in browserYes — fully client-side
Server requiredNo
FormulasYes — Excel-compatible
Multiple sheetsYes — tabs
Search & sortYes — built in
PersistenceYes — persistent: true
Column typestext, numeric, dropdown, checkbox, calendar, image, color
Based onJSSpreadsheet (jspreadsheet.js)
LicenseMIT
MaintainedVersion 0.0.1

Try It

Try in LiaScript Open in LiveEditor View on GitHub
  • Random — randomized exercise pools from larger question banks
  • TextAnalysis — analyze and grade text complexity
  • Chart.js — visualize spreadsheet data as bar, line, or pie charts

Related Posts

Chat-Simulation for LiaScript: Bring Dialogues to Life in Your Course

Use the Chat-Simulation template to embed animated, multi-participant chat conversations directly in your LiaScript course — ideal for dialogues, case studies, and collaborative learning scenarios.

Read More

ExplainGit for LiaScript: Visualize Git Repositories Interactively

Teach git branching, merging, and history with interactive animations directly in LiaScript — pre-define command sequences or let students type git commands live, powered by ExplainGit.

Read More

Random for LiaScript: Dynamic Quiz Banks and Randomized Practice Sets

Randomly sample exercises from a larger pool in LiaScript using the Random template — show only N items per page visit, support weighted selection, and filter out already-solved quizzes.

Read More