Python for Finance: Analyze Big Financial Data

(Elle) #1
In  [ 4 ]:  Cell(“B1”).value
Out[ 4 ]: u’Excel with Python’

In the same way as you change the value attribute of a Cell object, you can assign a


formula to it:


In  [ 5 ]:  Cell(“A9”).formula  =   ‘=Sum(A1:A8)’

In  [ 6 ]:  Cell(“A9”).value
Out[ 6 ]: 36

Table 12-2 lists the attributes of the DataNitro Cell object.


Table 12-2. DataNitro Cell attributes


Attribute Description

row

Row of the cell

col

Column of the cell

position

Position as a (row, col) tuple

sheet

Name of the sheet the cell is in

name

Name of the cell in Excel fashion

value

Value of the cell

vertical

All cell values including and below the cell

vertical_range

Excel range for all cells including and below the cell

horizontal

All cell values including and right of the cell

horizontal_range

Excel range for all cells including and right of the cell

table

All values including and below/right of the cell as nested list object

table_range

Excel range for table object

formula

Excel formula
Free download pdf