Does exist any racket library allowing reading excel files? I just need to read simple spreadsheet without any formulas etc.
Asked
Active
Viewed 1,010 times
3 Answers
2
you can try this package: simple-xlsx: read and write .xlsx file.

simmone
- 379
- 1
- 11
-
-
1I'm the simple-xlsx package's author, not support formula yet.If you want formula support, start a issue. I'm very pleased to work on it. – simmone May 05 '20 at 12:53
1
It depends on the way in which the spreadsheet is formatted. My standard practice is to use Excel to export the data in the form of a .csv file, then use Neil Van Dyke's csv-reading
package to parse it.
Does that help you?

John Clements
- 16,895
- 3
- 37
- 52
-
yes, it's an option, but i need reliable solution from user perspective. if user needs to convert xlsx to csv then there is huge room for error. I found phpexcel tool allowing reading excel files, may be something similar exists in racket, thank you – Jaro Oct 06 '17 at 08:23
-
Excel's internal formats can sometimes be moving targets. I just did some quick reading, and it appears that the format is in fact documented (well done, Microsoft), but it's represented as a 300-page extension to two other existing ISO standards (possibly each several hundred pages). On the bright side, it sounds like it is in fact an XML language, so you could definitely get started by using Racket's sxml package. Beyond this, you could probably put together something that works very reliably for a limited subset of xlsx files. Not easy, though. – John Clements Oct 06 '17 at 21:58
0
Here's a version that does not require any additional package. It supposes you exported the file in a csv (comma separated values) format from Excel. It is probably less robust than dedicated packages, but may be good enough for simple purposes:
#lang racket
(define lines (file->lines "my-csv-file.csv"))
; Change this to the character you chose for separating values when
; exporting the file in csv format (comma "," by default)
(define sep (regexp-quote ","))
(map (λ(l)(string-split l sep #:trim? #f #:repeat? #t))
lines)

Metaxal
- 1,083
- 8
- 10