zaz/doc/source/main/calc_data.rst

46 lines
685 B
ReStructuredText

Data
~~~~
Read
^^^^
* Get value from cell, automatic detect type and get value.
.. code-block:: python
sheet = app.active_sheet
cell = sheet['A1']
value = cell.value
info = f'Cell Type = {cell.type}\n\nCell Value = {cell.value}'
app.msgbox(info)
Write
^^^^^
* Automatic detect data type.
.. code-block:: python
sheet = app.active_sheet
# ~ Set int
sheet['A1'].value = 1
# ~ Set float
sheet['A2'].value = 10.5
# ~ Set string
sheet['A3'].value = 'Damn World'
# ~ Set date
sheet['A4'].value = app.today()
# ~ Set time
sheet['A5'].value = app.now(True)
# ~ Set datetime
sheet['A6'].value = app.now()