New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples and documentation improvements #64
Comments
@nukulb the write process takes a JSON object as described in the Cell Object Description section, which isn't particularly convenient ATM. I am working on a way to take a CSV or row object array and convert to the internal format. As a simple example using the intermediate format, suppose your data was in a 2d grid:
http://i.imgur.com/wfijIov.png Suppose you wanted to write that to a sheet called "SheetJS". Then the code would be:
In the future, there will be utility functions to handle most of the logistics for you. |
Preemptively closed this -- will deem complete once the documentation is up to snuff |
@SheetJSDev thanks a lot, I will try it out today but looks straightforward. |
@nukulb how is it going? |
I am starting this work tomorrow, I got side tracked with other stuff. Thanks for checking in. On Wed, May 28, 2014 at 6:24 PM, SheetJSDev notifications@github.comwrote:
Nukul Bhasin |
that seems to be failing on the last line when I got to write the file.
Output XLSX
Do I need a different version for the 'writeFile' method? |
seems like npm has a very old version of this. I ran npm pack myself to get 0.7.3 version and this example works. @SheetJSDev any chance you publish the latest to npm? |
@nukulb https://www.npmjs.org/package/xlsx shows that the latest version is 0.7.3 and has been there for the last 4 days. What version of node/npm are you using? Also, can you show the line for xlsx in your package.json? |
you are correct, npm has the right version problem seems to be on my end. I will figure it out on my end. Your code seems to be work fine. I will start doing some more complicated stuff tomorrow and I might ask more questions here. I really appreciate your help. Thanks. |
The README has a few browser and nodejs examples and the test suite also includes ad-hoc and round trip tests. Closing for now. If you encounter an issue with the examples please raise a new issue. |
So far I have only used to write to a new file. And it works great for this use case. Thanks for all the support. The next thing I am looking at is opening an existing file and then write to that file. Is there an example of this available? |
Since they use the same internal format, you can also use https://github.com/SheetJS/js-xls :
The test suite has a round trip section just for this: https://github.com/SheetJS/js-xlsx/blob/master/test.js#L630 |
Reopening since there is no complete example of editing an existing file in the documentation. |
Hello, Simplifying the read/write interfaces is something I'd like to see as well. I feel the current forms of traversal are too cumbersome. Any thoughts on what cleaner interfaces should look like? Are there "common structures" to Excel files the library should support? for example, simple tables? |
@eladxxx I agree that there should be a layer between the raw representation and applications. The interface is a tricky problem for a few reasons:
There should be a function interface so that we could easily change the model later (that probably should have been built at the beginning :/ c'est la vie), including:
... and a separate function for each fundamental operation. I'm inclined to keep this in a separate library and make the parsers expect a Workbook object -- there would be a dumb workbook implementation in this and in js-xls and they would use something more intelligent if you included the other script in the browser. NB: To support opening and editing files, we would probably need a real engine that can parse excel formulae (and, if we are ambitious, evaluate). Since that formula engine is also needed for shared formulae (see #67) that might be done sooner rather than later. |
You raise a lot of good points. However, what I meant by simple - and it could very well be that I'm looking at this too subjectively - is that we agree on some "common" input format(s) and work with that. For example, I deal with a lot of files that are simple tables. Some of them have the first row as headers, some don't. Think CSV data imported into Excel. It would be nice if the library had a built-in function to read this type of data so that I could do:
The idea of course isn't to provide Of course if we can't agree on common goals and/or "common" means formulae-heavy documents and such, then it might be that more thought should be given to how this simplification happens. That said, the interface functions you suggest seem useful, though I'm not sure they help in iterating over a document in order to parse it for some internal representation. |
@eladxxx As part of this issue from js-xls the JSON output function was overhauled. If you are specifically interested in the data, this should work:
If need be, |
Is there any documentation for |
@elad this is how i described the header option in the other thread:
(default behavior remains: use the first row as headers) this clearly needs to be documented properly |
Is there an API to initiate a workbook now? |
- parse_XFExtGradient stubbed (fixes SheetJS#62, h/t @oakuraape) - default to UTF16LE (fixes SheetJS#64, h/t @ajuhos) - ensure that date1904 is propagated to SSF (fixes SheetJS#66, h/t @Martin-Pitt) - pin CFB version in anticipation of future changes
It would be great if the documentation listed accepted "type" values for the read() function (and what those options mean). For example: buffer, base64, file, binary, etc. Are pull requests being looked at? If so, I'd be up for helping out on this. |
We're slowly improving the documentation. The underlying structure is stabilizing, and for most supported features all of the parsers should generate the same fields consistent with the README. At the moment we're trying to go feature by feature and hammer out documentation while we ensure the main supported parsers (XLS/XLSX/XLSB/SpreadsheetML) produce similar parsed objects. If there is anything unclear in the README please let us know where we can improve. @blakek if you are interested in contributing documentation, we'd gladly accept a PR! Documentation is the one area that doesn't involve hours of testing :D If you have any demos or projects, please add a link to the wiki page so others can find it! |
We set up a gitbook integration: https://sheetjs.gitbooks.io/docs/ |
Fixed Style Table in README.md
I am looking for an example on writing a JSON into xlxs file.
The read works great but I unable to find a working example. Can someone help me with a link or simply point me in the right direction.
The text was updated successfully, but these errors were encountered: