Using functions

Function example
Create a spreadsheet class and export as html.

Functions available:

  • SUM - sum values in a cell range
  • AVERAGE - average values in a cell range
  • MAX - max value in a cell range
  • MIN - min value in a cell range
  • ABS - absolute value of cell
  • POWER - power of value
  • SQRT - square root of value
  • SIN,COS,TAN,ASIN,ACOS,ATAN - geometric functions of radian values
  • PI - pi constant
  • IF - conditional if statment
  • CUT - cut text string and return one field

Users can add new functions using a register function option.

from simpleodspy.sodsspreadsheet import SodsSpreadSheet
from simpleodspy.sodshtml import SodsHtml
t = SodsSpreadSheet()
t.setValue("D2", 123.5)
t.setValue("D3", "=3.0/5.0")
t.setValue("D4", "=D2*3")
t.setValue("D5", "=ABS(D3)")
t.setValue("D6", "=SIN(PI * D3)")
t.setValue("D7", "=SUM(D2:D6)")
t.setValue("D8", "=IF(D3>D2;D6;D7)")
t.setValue("E3", "Hello,world")
t.setValue("E4", "=CUT(E3,1)")
tw = SodsHtml(t)"test.html")