Skip to content →

How to use formulas?

Setting a formula to a Cell

Setting a formula in a Cell

PhpSpreadsheet parses everything that starts with = as a formula, and to get the value of a cell that contains a formula you use the function getCalculatedValue()

If you want to use ‘=’ as part of a string and not to be parsed as a formula, you will need to escape
To do this, you need to “escape” the value by setting it as “quoted text”.\

Locale Settings for Formulae

You can also create a formula using the function names and argument separators appropriate to the defined locale; then translate it to English before setting the cell value:
Currently, formula translation only translates the function names, the constants TRUE and FALSE, and the function argument separators.

Formula pre-calculation

Performing formula calculations

Formulas involving numbers and text

Formulas involving numbers and text may produce unexpected results or even unreadable file contents. For example, the formula =3+”Hello ” is expected to produce an error in Excel (#VALUE!). Due to the fact that PHP converts “Hello ” to a numeric value (zero), the result of this formula is evaluated as 3 instead of evaluating as an error. This also causes the Excel document being generated as containing unreadable content.

Disable Cache

Will disable calculation caching, and flush the current calculation cache.

Flush Cache

If you want only to flush the cache, then you can call

Published in Uncategorized

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.