https://github.com/fslaborg/FsSpreadsheet
Spreadsheet creation and manipulation in F#, Javascript, and Python.
https://github.com/fslaborg/FsSpreadsheet
csv dotnet excel fsharp openxml spreadsheet xlsx
Last synced: 4 months ago
JSON representation
Spreadsheet creation and manipulation in F#, Javascript, and Python.
- Host: GitHub
- URL: https://github.com/fslaborg/FsSpreadsheet
- Owner: fslaborg
- License: mit
- Created: 2021-12-09T15:12:25.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-16T12:48:20.000Z (5 months ago)
- Last Synced: 2025-07-31T20:23:07.247Z (4 months ago)
- Topics: csv, dotnet, excel, fsharp, openxml, spreadsheet, xlsx
- Language: F#
- Homepage: http://fslab.org/FsSpreadsheet/
- Size: 4.38 MB
- Stars: 36
- Watchers: 4
- Forks: 2
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FsSpreadsheet
Spreadsheet creation and manipulation in FSharp
Latest Release
Downloads
Target
Python
JavaScript
.NET
Fable JavaScript
Fable Python
## DSL
```fsharp
#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
```fsharp
#r "nuget: FsSpreadsheet.Net"
open FsSpreadsheet.Net
spreadsheet.ToFile(excelFilePath)
```
------->

## Code Examples
```fsharp
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](https://nodejs.org/en/download)
- verify with `node --version` (Tested with v18.16.1)
- verify with `npm --version` (Tested with v9.2.0)
- [.NET SDK](https://dotnet.microsoft.com/en-us/download)
- verify with `dotnet --version` (Tested with 7.0.306)
- [Python](https://www.python.org/downloads/)
- verify with `py --version` (Tested with 3.12.2)
### Local Setup
1. Setup dotnet tools
`dotnet tool restore`
2. Install NPM dependencies
`npm install`
3. Setup python environment
`py -m venv .venv`
4. Install [Poetry](https://python-poetry.org/) and dependencies
1. `.\.venv\Scripts\python.exe -m pip install -U pip setuptools`
2. `.\.venv\Scripts\python.exe -m pip install poetry`
3. `.\.venv\Scripts\python.exe -m poetry install --no-root`
Verify correct setup with `./build.cmd runtests`
5. `build.cmd ` where `` may be
- if `` is empty, it just runs dotnet build after cleaning everything
- `runtests` to run unit tests
- `runtestsjs` to only run JS unit tests
- `runtestsdotnet` to only run .NET unit tests
- `runtestpy` to only run Python unit tests
- `releasenotes semver:` where `` may be `major`, `minor`, or `patch` to update RELEASE_NOTES.md
- `pack` to create a NuGet release
- `packprelease` to create a NuGet prerelease
- `builddocs` to create docs
- `builddocsprerelease` to create prerelease docs
- `watchdocs` to create docs and run them locally
- `watchdocsprelease` to create prerelease docs and run them locally
- `release` to create a NuGet, NPM, PyPI and GitHub release