Method: Axlsx::Cell#type

Defined in:
lib/axlsx/workbook/worksheet/cell.rb

#typeSymbol

Note:

If the value provided cannot be cast into the type specified, type is changed to :string and the following logic is applied. :string to :integer or :float, type conversions always return 0 or 0.0 :string, :integer, or :float to :time conversions always return the original value as a string and set the cells type to :string. No support is currently implemented for parsing time strings.

The cell's data type. Changing the type for a cell will recast the value into that type. If no type option is specified in the constructor, the type is automatically determed.

Returns:

  • (Symbol)

    The type of data this cell's value is cast to.

Raises:

  • (ArgumentExeption)

    Cell.type must be one of [:date, time, :float, :integer, :string, :boolean]

See Also:

  • #cell_type_from_value


94
95
96
# File 'lib/axlsx/workbook/worksheet/cell.rb', line 94

def type
  defined?(@type) ? @type : :string
end