Reading data from Excel in Haskell

2020-08-12 18:35发布

问题:

I would like to get data from .xls files without manually opening Excel. One possibility is to use COM automation.

There are the com-1.2.3 and hdirect packages, but I can't find any examples of how to use these packages with Excel.

Does anyone have a solution for this?

回答1:

With something like this, if your needs are relatively simple, I've found that it's more straightforward to find/write a command line executable that just pulls out a csv from the xls file. Then you invoke that executable from haskell, and proceed with its output from there.



回答2:

In Ruby, I use rjb (ruby java bridge) and use a library from Java for excel (e.g. JExcelAPI as explained in http://www.slideshare.net/weyus/rjb).

It seems that there are some Java bridges for Haskell? http://www.haskell.org/haskellwiki/Applications_and_libraries/Interfacing_other_languages#Java Though I have no experience with them...

I wonder whether that's the best solution...



回答3:

Now there is also xlsx on Hackage (for the Office Open XML xlsx format), although I haven't yet tried it myself.