You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+26
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com)
6
6
and this project adheres to [Semantic Versioning](https://semver.org).
7
7
8
+
## TBD - 3.0.0
9
+
10
+
### Dynamic Arrays
11
+
12
+
- Support for Excel dynamic arrays is added. It is an opt-in feature, so our hope is that there will be no BC breaks, but it is a very large change. Full support is added for Xlsx. It is emulated as Ctrl-Shift-Enter arrays for Ods read and write and Excel2003 and Gnumeric read. Html/Pdf and Csv writers will populate cells on output if they are the result of array formulas. No support is added for Xls or Slk.
5. <spanid="footnote5">Xlsx macros can be read and written; their values can be retrieved and changed, but only in a binary form which is unlikely to be useful</span>
1006
1006
6. <spanid="footnote6">There is very limited support for reading styles from an Ods spreadsheet. Writing styles has better support, although Number Format is incomplete.</span>
1007
1007
7. <spanid="footnote7">In most cases, Html reader processes only inline styles; styles provided by Css classes may be ignored.</span>
1008
+
8. <spanid="footnote8">Code must [opt in](../topics/recipes.md#array-formulas) to array output.</span>
When writing a formula to a cell, formulae should always be set as they would appear in an English version of Microsoft Office Excel, and PhpSpreadsheet handles all formulae internally in this format. This means that the following rules hold:
27
+
Calling `getCalculatedValue()` on a cell that doesn't contain a formula will simply return the value of that cell; but if the cell does contain a formula, then PhpSpreadsheet will evaluate that formula to calculate the result.
28
+
29
+
There are a few useful mehods to help identify whether a cell contains a formula or a simple value; and if a formula, to provide further information about it:
will return a boolean true/false, telling you whether that cell contains a formula or not, so you can determine if a call to `getCalculatedVaue()` will need to perform an evaluation.
35
+
36
+
For more details on working with array formulas, see the [the recipes documentationn](./recipes.md/#array-formulas).
37
+
38
+
When writing a formula to a cell, formulas should always be set as they would appear in an English version of Microsoft Office Excel, and PhpSpreadsheet handles all formulas internally in this format. This means that the following rules hold:
26
39
27
40
- Decimal separator is `.` (period)
28
41
- Function argument separator is `,` (comma)
@@ -91,6 +104,11 @@ formula calculation is subject to PHP's language characteristics.
91
104
Not all functions are supported, for a comprehensive list, read the
92
105
[function list by name](../references/function-list-by-name.md).
93
106
107
+
#### Array arguments for Function Calls in Formulas
108
+
109
+
While most of the Excel function implementations now support array arguments, there are a few that should accept arrays as arguments but don't do so.
110
+
In these cases, the result may be a single value rather than an array; or it may be a `#VALUE!` error.
111
+
94
112
#### Operator precedence
95
113
96
114
In Excel `+` wins over `&`, just like `*` wins over `+` in ordinary
@@ -161,7 +179,7 @@ number of seconds from the PHP/Unix base date. The PHP/Unix base date
161
179
(0) is 00:00 UST on 1st January 1970. This value can be positive or
162
180
negative: so a value of -3600 would be 23:00 hrs on 31st December 1969;
163
181
while a value of +3600 would be 01:00 hrs on 1st January 1970. This
164
-
gives PHP a date range of between 14th December 1901 and 19th January
182
+
gives 32-bit PHP a date range of between 14th December 1901 and 19th January
Copy file name to clipboardExpand all lines: docs/topics/reading-files.md
+87-1
Original file line number
Diff line number
Diff line change
@@ -168,6 +168,87 @@ Once you have created a reader object for the workbook that you want to
168
168
load, you have the opportunity to set additional options before
169
169
executing the `load()` method.
170
170
171
+
All of these options can be set by calling the appropriate methods against the Reader (as described below), but some options (those with only two possible values) can also be set through flags, either by calling the Reader's `setFlags()` method, or passing the flags as an argument in the call to `load()`.
Many Excel files have empty rows or columns at the end of a worksheet, which can't easily be seen when looking at the file in Excel (Try using Ctrl-End to see the last cell in a worksheet).
206
+
By default, PhpSpreadsheet will load these cells, because they are valid Excel values; but you may find that an apparently small spreadsheet requires a lot of memory for all those empty cells.
207
+
If you are running into memory issues with seemingly small files, you can tell PhpSpreadsheet not to load those empty cells using the `setReadEmptyCells()` method.
208
+
209
+
```php
210
+
$inputFileType = 'Xls';
211
+
$inputFileName = './sampleData/example1.xls';
212
+
213
+
/** Create a new Reader of the type defined in $inputFileType **/
/** Advise the Reader that we only want to load cell's that contain actual content **/
216
+
$reader->setReadEmptyCells(false);
217
+
/** Load $inputFileName to a Spreadsheet Object **/
218
+
$spreadsheet = $reader->load($inputFileName);
219
+
```
220
+
221
+
Note that cells containing formulae will still be loaded, even if that formula evaluates to a NULL or an empty string.
222
+
Similarly, Conditional Styling might also hide the value of a cell; but cells that contain Conditional Styling or Data Validation will always be loaded regardless of their value.
223
+
224
+
This option is available for the following formats:
If your workbook contains a number of worksheets, but you are only
@@ -642,7 +725,7 @@ Xlsx | NO | Xls | NO | Xml | NO |
642
725
Ods | NO | SYLK | NO | Gnumeric | NO |
643
726
CSV | YES | HTML | NO
644
727
645
-
###A Brief Word about the Advanced Value Binder
728
+
## A Brief Word about the Advanced Value Binder
646
729
647
730
When loading data from a file that contains no formatting information,
648
731
such as a CSV file, then data is read either as strings or numbers
@@ -694,6 +777,9 @@ Xlsx | NO | Xls | NO | Xml | NO
694
777
Ods | NO | SYLK | NO | Gnumeric | NO
695
778
CSV | YES | HTML | YES
696
779
780
+
Note that you can also use the Binder to determine how PhpSpreadsheet identified datatypes for values when you set a cell value without explicitly setting a datatype.
781
+
Value Binders can also be used to set formatting for a cell appropriate to the value.
782
+
697
783
## Error Handling
698
784
699
785
Of course, you should always apply some error handling to your scripts
0 commit comments