summaryrefslogtreecommitdiffhomepage
path: root/examples/automatic_data_types_example.md
blob: cdae2d5c80faced2b18857de0c4fd7e509982713 (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
## Description

The data types are automatically calculated into the cell.

## Code

```ruby
require 'axlsx'

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

wb.add_worksheet(name: 'Automatic cell types') do |sheet|
  sheet.add_row ['Date', 'Time', 'String', 'Boolean', 'Float', 'Integer']
  sheet.add_row [Date.today, Time.now, 'value', true, 0.1, 1]
end

p.serialize 'automatic_data_types_example.xlsx'
```

## Output

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

Notes: The time column has the full datetime in it, you could customize it with format codes.