Openpyxl
— is a Python library with which you can perform several operations on Excel files, such as reading, writing, arithmetic, and graphing. Let`s see how to perform various arithmetic operations using openpyxl.

Exit:
import
openpyxl
wb
=
openpyxl.Workbook ()
sheet
=
wb.active
sheet [
`A1`
]
=
2
sheet [
`A2`
]
=
3
sheet [
`A3`
]
=
4
sheet [
`A4`
]
=
5
sheet [
` A5`
]
=
6
# The value in cell A7 is set to the formula
# which multiplies the values in A1, A2, A3, A4, A5.
sheet [
`A7`
]
=
` = PRODUCT (A1: A5) `
wb.save (
"product.xlsx" )
Output:

Output:

Output:
import
openpyxl
wb
=
openpyxl.Workbook ()
sheet
=
wb.active
# The value in the cell is set by the formula
# which gives the remainder or value module.
sheet [
`A1`
]
=
`= MOD (64, 8)`
sheet [
`A2`
]
= `= MOD (25, 4)`
wb.save (
"modulus.xlsx"
)
Output:
