FsSpreadsheet
Spreadsheet creation and manipulation in F#, Javascript, and Python.
Install / Use
/learn @fslaborg/FsSpreadsheetREADME
FsSpreadsheet
Spreadsheet creation and manipulation in FSharp
<table> <thead> <tr> <th>Latest Release</th> <th>Downloads</th> <th>Target</th> </tr> </thead> <tbody> <tr> <td> <a href="https://pypi.org/project/fsspreadsheet/"> <img src="https://img.shields.io/pypi/v/fsspreadsheet?logo=pypi" alt="latest release" /> </a> </td> <td> <a href="https://pepy.tech/project/siren-dsl"> <img alt="Pepy Total Downlods" src="https://img.shields.io/pepy/dt/siren-dsl?label=fsspreadsheet&color=blue" /> </a> </td> <td>Python</td> </tr> <!-- js package --> <tr> <td> <a href="https://www.npmjs.com/package/@fslab/fsspreadsheet"> <img src="https://img.shields.io/npm/v/@fslab/fsspreadsheet?logo=npm" alt="latest release" /> </a> </td> <td> <a href="https://www.npmjs.com/package/@fslab/fsspreadsheet"> <img src="https://img.shields.io/npm/dt/@fslab/fsspreadsheet?label=@fslab/fsspreadsheet" alt="downloads" /> </a> </td> <td>JavaScript</td> </tr> <!-- f# nuget package core --> <tr> <td> <a href="https://www.nuget.org/packages/FsSpreadsheet/"> <img src="https://img.shields.io/nuget/v/FsSpreadsheet?logo=nuget" alt="latest release" /> </a> </td> <td> <a href="https://www.nuget.org/packages/FsSpreadsheet/"> <img src="https://img.shields.io/nuget/dt/FsSpreadsheet?label=FsSpreadsheet" alt="downloads" /> </a> </td> <td></td> </tr> <!-- f# nuget package net --> <tr> <td> <a href="https://www.nuget.org/packages/FsSpreadsheet.Net/"> <img src="https://img.shields.io/nuget/v/FsSpreadsheet.Net?logo=nuget" alt="latest release" /> </a> </td> <td> <a href="https://www.nuget.org/packages/FsSpreadsheet.Net/"> <img src="https://img.shields.io/nuget/dt/FsSpreadsheet.Net?label=FsSpreadsheet.Net" alt="downloads" /> </a> </td> <td>.NET</td> </tr> <!-- f# nuget package js --> <tr> <td> <a href="https://www.nuget.org/packages/FsSpreadsheet.Js/"> <img src="https://img.shields.io/nuget/v/FsSpreadsheet.Js?logo=nuget" alt="latest release" /> </a> </td> <td> <a href="https://www.nuget.org/packages/FsSpreadsheet.Js/"> <img src="https://img.shields.io/nuget/dt/FsSpreadsheet.Js?label=FsSpreadsheet.Js" alt="downloads" /> </a> </td> <td>Fable JavaScript</td> </tr> <!-- f# nuget package py --> <tr> <td> <a href="https://www.nuget.org/packages/FsSpreadsheet.Py/"> <img src="https://img.shields.io/nuget/v/FsSpreadsheet.Py?logo=nuget" alt="latest release" /> </a> </td> <td> <a href="https://www.nuget.org/packages/FsSpreadsheet.Py/"> <img src="https://img.shields.io/nuget/dt/FsSpreadsheet.Py?label=FsSpreadsheet.Py" alt="downloads" /> </a> </td> <td>Fable Python</td> </tr> </tbody> </table>DSL
#r "nuget: FsSpreadsheet"
open FsSpreadsheet.DSL
let dslTree =
workbook {
sheet "MySheet" {
row {
cell {1}
cell {2}
cell {3}
}
row {
4
5
6
}
}
}
let spreadsheet = dslTree.Value.Parse()
ExcelIO
#r "nuget: FsSpreadsheet.Net"
open FsSpreadsheet.Net
spreadsheet.ToFile(excelFilePath)
------->

Code Examples
let tables = workbook.GetTables()
let worksheets = workbook.GetWorksheets()
// get worksheet and its table as tuple
let worksheetsAndTables =
tables
|> List.map (
fun t ->
let associatedWs =
worksheets
|> List.find (
fun ws ->
ws.Tables
|> List.exists (fun t2 -> t2.Name = t.Name)
)
associatedWs, t
)
Development
Requirements
- nodejs and npm
- verify with
node --version(Tested with v18.16.1) - verify with
npm --version(Tested with v9.2.0)
- verify with
- .NET SDK
- verify with
dotnet --version(Tested with 7.0.306)
- verify with
- Python
- verify with
py --version(Tested with 3.12.2)
- verify with
Local Setup
-
Setup dotnet tools
dotnet tool restore -
Install NPM dependencies
npm install -
Setup python environment
py -m venv .venv -
Install Poetry and dependencies
.\.venv\Scripts\python.exe -m pip install -U pip setuptools.\.venv\Scripts\python.exe -m pip install poetry.\.venv\Scripts\python.exe -m poetry install --no-root
Verify correct setup with ./build.cmd runtests
build.cmd <target>where<target>may be- if
<target>is empty, it just runs dotnet build after cleaning everything runteststo run unit testsruntestsjsto only run JS unit testsruntestsdotnetto only run .NET unit testsruntestpyto only run Python unit tests
releasenotes semver:<version>where<version>may bemajor,minor, orpatchto update RELEASE_NOTES.mdpackto create a NuGet releasepackpreleaseto create a NuGet prerelease
builddocsto create docsbuilddocsprereleaseto create prerelease docs
watchdocsto create docs and run them locallywatchdocspreleaseto create prerelease docs and run them locallyreleaseto create a NuGet, NPM, PyPI and GitHub release
- if
Contribution guidelines
- Make sure that all contributions run on all three languages: F#, Javascript and Python
- Please add failing tests prior to fixing a bug against which to code
- If applicable, include issue number in test name as such:
"worksOnFilledTable (issue #100)"
- If applicable, include issue number in test name as such:
- Make use of XML tags to comment your code as such:
/// <summary> /// Checks if there is an FsCell at given column index of a given FsRow. /// </summary> /// <param name="colIndex">The number of the column where the presence of an FsCell shall be checked.</param> /// <param name="row"></param> static member hasCellAt colIndex (row : FsRow) = row.HasCellAt colIndex
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
