Coder Social home page Coder Social logo

Comments (10)

jappeace avatar jappeace commented on July 18, 2024 2

yes! Supercede is implementing this at the moment, the api is unstable but for reading it sort of works already here: https://github.com/SupercedeTech/xlsx [1]

We may change how the reading api works, (there are two engineers working on this now including me), but we settled on the shape of SheetItem at least so you can program against that (stuff maybe added). I'm working on writing xlsx as well. The prototype for writing is done, but it may still have some bugs left.

We're intending to upstream the work once we got it to work reliably.

[1] note that's a different repo than mine, I originally implemented it as part of "research day" but now it turns out client actually need it so it got moved to supercede github.

from xlsx.

jappeace avatar jappeace commented on July 18, 2024 1

Working around it now with csv but there is definitely some interest here from the business side to producing xslx files, so I'll be doing this in the future.

Your review and feedback would be appreciated 😉

from xlsx.

qrilka avatar qrilka commented on July 18, 2024

There was a ticket #7 about this
As there was no particular motivation it was closed.
If you're willing to contribute something like this I'd be glad to review the code.

from xlsx.

idontgetoutmuch avatar idontgetoutmuch commented on July 18, 2024

I have just run into this problem and will probably now have to convert to the file to CSV and use streaming via cassava.

from xlsx.

idontgetoutmuch avatar idontgetoutmuch commented on July 18, 2024

@jappeace if you made any progress on this which you can share, I could maybe work on it a bit more.

from xlsx.

idontgetoutmuch avatar idontgetoutmuch commented on July 18, 2024

@jappeace I notice you have done a lot of work here: https://github.com/jappeace/xlsx.

What I'd like to be able to do is read a row at a time e.g. to create a sum of a column. Is it possible to do this with your clone?

from xlsx.

jappeace avatar jappeace commented on July 18, 2024

Let me know if you need help, have questions or any issues. It's really important for the company I work for to get this right 🙂

from xlsx.

idontgetoutmuch avatar idontgetoutmuch commented on July 18, 2024

If you could show me how I would get e.g. rows 5, 6 and 7 from an .xlsx file and also how I can process a table row by row that would be really helpful.

At the moment I am using R to convert a tab in an .xlsx file to a .csv file and then using cassava with something like the following to get rows with indices in is:

  let bar :: [[String]] -> Records [String] -> IO [[String]]
      bar acc baz =
        case baz of
          Cons (Left s)          _ -> error s
          Cons (Right [])        r -> bar acc r
          Cons (Right a@(x : _)) r -> if x `elem` (map show is)
                                        then bar (a : acc) r
                                        else bar acc r
          Nil _ _                  -> return acc

https://hackage.haskell.org/package/cassava-0.5.2.0/docs/Data-Csv-Streaming.html lets you process a row at a time which is what I want to do after I have processed the given rows.

Many thanks

from xlsx.

jappeace avatar jappeace commented on July 18, 2024

First obtain a producer conduit from your xlsx file, probably you want to use sourceFile. Then put that into readxlsx.
Now you have a conduit of sheetItems, which you can filter, and fold.

Mind you to use those combinator you have to combine with .| which makes the output of the left conduit the input to the right one.

It all seems a bit convoluted but it allows you to do lazy io (constant memory).

from xlsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.