PHPOffice / PhpSpreadsheet

A pure PHP library for reading and writing spreadsheet files
https://phpspreadsheet.readthedocs.io
MIT License
13.35k stars 3.47k forks source link

Reader/Writer for Apple Numbers files #1584

Open MarkBaker opened 4 years ago

MarkBaker commented 4 years ago

This is:

- [ ] a bug report
- [X] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

Add support for Reading/Writing Apple Numbers spreadsheet files

SheetJSDev commented 2 years ago

If there is real interest in exploring Numbers files:

https://oss.sheetjs.com/notes/iwa/ we tried to document exactly how values work in Numbers tables. https://github.com/SheetJS/sheetjs/blob/master/modules/83_numbers.ts code reference.

The notes should cover the major implementation details for extracting values (extracting PHP scalars from the tables in a file). Please let us know if there are gaps or topics that should be discussed in more detail.

The writer starts from a stripped template and rewrites the tiles / range / sheet names, currently limited to 1 worksheet of up to 1000 columns (ALL is the actual limit in Numbers) x 256 rows.

If you'd like to see some sample reading/writing, if you have NodeJS installed you can run something like

$ npx xlsx-cli test.numbers # print CSV based on the first sheet in test.numbers
$ npx xlsx-cli --list-sheets test.numbers # list all table names

$ npx xlsx-cli --numbers test.csv # generate test.csv.numbers based on the contents of test.csv
MarkBaker commented 2 years ago

Thank you @SheetJSDev. That looks very useful