FsSpreadsheet
FsSpreadsheet copied to clipboard
Spreadsheet creation and manipulation in F#, Javascript, and Python.
FsSpreadsheet
Spreadsheet creation and manipulation in FSharp
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