Data

Read

  • Get value from cell, automatic detect type and get value.

sheet = app.active_sheet
cell = sheet['A1']

value = cell.value
info = f'Cell Type = {cell.type}\n\nCell Value = {cell.value}'
app.msgbox(info)
  • Get date, time and datetime like data Python.

sheet = app.active_sheet
cell = sheet['A1']
app.msgbox(cell.date)
app.msgbox(cell.time)
app.msgbox(cell.datetime)
  • Get values from cell range.

sheet = app.active_sheet
rango = sheet['A1:B5']
app.msgbox(rango.data)
  • Get formulas

sheet = app.active_sheet
rango = sheet['A1:B5']
app.msgbox(rango.formula)
  • Get array formula

sheet = app.active_sheet
rango = sheet['C10:E15']
app.msgbox(rango.array_formula)
  • Get like dictionary

The first row in range are the keys.

sheet = app.active_sheet
rango = sheet['A1:B5']
app.msgbox(rango.dict)

Write

  • Automatic detect data type.

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 formula
sheet['A4'].value = '=RAND()'

# ~ Set date
sheet['A5'].value = app.today()

# ~ Set time
sheet['A6'].value = app.now(True)

# ~ Set datetime
sheet['A7'].value = app.now()