Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d6y/s2s
Convert Spreadsheets to Scala Source
https://github.com/d6y/s2s
Last synced: about 1 month ago
JSON representation
Convert Spreadsheets to Scala Source
- Host: GitHub
- URL: https://github.com/d6y/s2s
- Owner: d6y
- License: apache-2.0
- Created: 2015-06-19T14:48:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-19T16:21:13.000Z (over 9 years ago)
- Last Synced: 2023-03-10T19:08:48.613Z (almost 2 years ago)
- Language: Scala
- Size: 262 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spreadsheet to Scala
## Outline
Read a spreadsheet, and for some specified set of cells...
- convert cell formulas to functions.
- convert cells without formulas to constants.
- convert the current value of a formula in the spreadsheet to a unit test.### Example
Given a spreadsheet like this:
```
+----- A ----
1 | 11
2 | 13
3 | =SUM(A1,A2)
```...it should be converted to something along the lines of this:
```
lazy val cellA1 = 11
lazy val cellA2 = 13
def cellA3(x: Int, y: Int) = x + y
asssert( cellA3(cellA1,cellA2) === 24 )
```## Approach
- Parse a formula into a tree
- Chase references and include them
- Generate code## Challenges
- Excel formula syntax not uniform
- Functions take values, arrays, ranges...
- Differences between Scala and Excel formula behaviour
- Cyclic references˜
- Infering/converting types
- References across worksheets
- How does Excel treat dates and timezones?
- What are array formula?
- The cached value for a formula could be stale.
- Spreadsheets other than Excel
- ...We'll do some simple things, and see what cases present themselves.
# Current Status
Does almost nothing:
```
$ sbt run
[info] Running s2s.Main
FormulaCell(SUM(A1,A2),NumericCell(24.0))
Parsing SUM(A1,A2) ...
Success(Func(SUM,CellRef(A1),CellRef(A2)))
```