Spreadsheet creation and manipulation in FSharp
Latest Release | Downloads | Target |
---|---|---|
|
|
Python |
|
|
JavaScript |
|
|
|
|
|
.NET |
|
|
Fable JavaScript |
|
|
Fable Python |
#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()
#r "nuget: FsSpreadsheet.Net"
open FsSpreadsheet.Net
spreadsheet.ToFile(excelFilePath)
------->
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
)
- 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
-
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 runtests
to run unit testsruntestsjs
to only run JS unit testsruntestsdotnet
to only run .NET unit testsruntestpy
to only run Python unit tests
releasenotes semver:<version>
where<version>
may bemajor
,minor
, orpatch
to update RELEASE_NOTES.mdpack
to create a NuGet releasepackprelease
to create a NuGet prerelease
builddocs
to create docsbuilddocsprerelease
to create prerelease docs
watchdocs
to create docs and run them locallywatchdocsprelease
to create prerelease docs and run them locallyrelease
to create a NuGet, NPM, PyPI and GitHub release
- if
- 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