-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
29 lines (24 loc) · 653 Bytes
/
app.py
File metadata and controls
29 lines (24 loc) · 653 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import openpyxl as xl
from openpyxl.chart import BarChart, Reference
wb=xl.load_workbook('transactions.xlsx')
sheet=wb['Sheet1']
cell=sheet['a1']
cell=sheet.cell(1,1)
print(cell.value)
print(sheet.max_row)
for row in range(2, sheet.max_row + 1):
cell = sheet.cell(row,3)
print (cell.value)
corrected_price = cell.value*0.9
corrected_price_cell = sheet.cell(row,4)
corrected_price_cell .value = corrected_price
print(corrected_price_cell.value)
values=Reference(sheet,
min_row=2,
max_row=sheet.max_row,
min_col=4,max_col=4
)
chart=BarChart()
chart.add_data(values)
sheet.add_chart(chart,'e2')
wb.save('transactions3.xlsx')