Examples

Formulas

{% xlsdocument %}
    {% xlssheet %}
        {% xlsrow %}
            {% xlscell %}667.5{% endxlscell %}{# A1 #}
            {% xlscell %}2{% endxlscell %}{# B1 #}
        {% endxlsrow %}
        {% xlsrow %}
            {% xlscell %}=A1*B1+2{% endxlscell %}
        {% endxlsrow %}
        {% xlsrow %}
            {% xlscell %}=SUM(A1:B1){% endxlscell %}
        {% endxlsrow %}
    {% endxlssheet %}
{% endxlsdocument %}

Note

It can be faster to calculate formulas in the template or the controller.

Templates

{% xlsdocument { 'template': '@Hello/templates/template.xlsx' } %}
    {% xlssheet %}
        {# ... #}
    {% endxlssheet %}
{% endxlsdocument %}

Note

If you want to save your templates outside of your views folder consider using your own Twig namespace.

More examples

For more advanced examples check the unit test scenarios here:

https://github.com/MewesK/TwigSpreadsheetBundle/tree/master/tests/Twig/Fixtures/views