put_value method

put_value

Puts a boolean value into the cell.

def put_value(self, bool_value):
    ...
ParameterTypeDescription
bool_valuebool

put_value

Puts an integer value into the cell.

def put_value(self, int_value):
    ...
ParameterTypeDescription
int_valueintInput value

put_value

Puts a double value into the cell.

def put_value(self, double_value):
    ...
ParameterTypeDescription
double_valuefloatInput value

put_value

Puts a string value into the cell.

def put_value(self, string_value):
    ...
ParameterTypeDescription
string_valuestrInput value

put_value

Puts a DateTime value into the cell.

def put_value(self, date_time):
    ...
ParameterTypeDescription
date_timeDateTimeInput value

Remarks

Setting a DateTime value for a cell dose not means the cell will be formatted as date time automatically. DateTime value was maintained as numeric value in the data model of both ms excel and Aspose.Cells. Whether the numeric value will be taken as the numeric value itself or date time depends on the number format applied on this cell. If this cell has not been formatted as date time, it will be displayed as a numeric value even though what you input is DateTime.

Example

This example shows how to set DateTime value to a cell and make it be displayed as date time.

from aspose.cells import Workbook
from datetime import datetime

excel = Workbook()
cells = excel.worksheets[0].cells
# Put date time into a cell
cell = cells.get(0, 0)
cell.put_value(datetime(2023, 5, 15))
style = cell.get_style(False)
style.number = 14
cell.set_style(style)

put_value

Puts an object value into the cell.

def put_value(self, object_value):
    ...
ParameterTypeDescription
object_valueanyinput value

put_value

Puts a string value into the cell and converts the value to other data type if appropriate.

def put_value(self, string_value, is_converted):
    ...
ParameterTypeDescription
string_valuestrInput value
is_convertedboolTrue: converted to other data type if appropriate.

put_value

Puts a value into the cell, if appropriate the value will be converted to other data type and cell’s number format will be reset.

def put_value(self, string_value, is_converted, set_style):
    ...
ParameterTypeDescription
string_valuestrInput value
is_convertedboolTrue: converted to other data type if appropriate.
set_styleboolTrue: set the number format to cell’s style when converting to other data type

See Also