summaryrefslogtreecommitdiffhomepage
path: root/examples/escape_formula_example.md
blob: fb23ce66b81f6d62bf53d0f51e1ae76855f87e70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Description

You could escape formulas

## Code

```ruby
require 'axlsx'

p = Axlsx::Package.new
wb = p.workbook

wb.add_worksheet(name: 'Escaping Formulas') do |sheet|
  sheet.add_row [1, 2, 3, '=SUM(A2:C2)'], escape_formulas: true
  sheet.add_row [
    '=IF(2+2=4,4,5)',
    '=IF(13+13=4,4,5)',
    '=IF(99+99=4,4,5)'
  ], escape_formulas: [true, false, true]
end

p.serialize 'escape_formula_example.xlsx'
```

## Output

![Output](images/escape_formula_example.png "Output")