From 3790d8530f4d215811d45f9856d065a362bc5c51 Mon Sep 17 00:00:00 2001 From: Raymond Bautista Date: Sun, 5 Nov 2023 20:11:23 +0800 Subject: [PATCH] created transactions2.xlsx to store the results of data management from transactions.xlsx. on using_pip_openpyxl, made an an exercise on this. need to apply 10% discount on all the values under C column. Made a chart. This is just a practice to familiarize myself with the Python packages available on the Python Package Index. myself with its available functionalities --- transactions2.xlsx | Bin 0 -> 7210 bytes using_pip_openpyxl.py | 23 +++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 transactions2.xlsx diff --git a/transactions2.xlsx b/transactions2.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..c00fb6d0e9fa1c829669eb17ea1798ef109c7f38 GIT binary patch literal 7210 zcmZ`;1yodP*B(+*7`nTqyQRAYq(K4c?(UFolHbIkzw5nx_nWoe zIWx0nKj+>1-RIe*Bnt(N0RRBt0L@v(uO+lPko>{ls=*5tyo_uNmF#V79hlzO+A_LY zS;|MrBX%;QiapBgE?cV|ldzCX=dKNSNO5t-7>POu-Fd$1h+gDhVUB3R9MtG0ci{-` zF7yTtNCN5*CAvhXig6_=@ys-cght)M(Z85w`X|IVPL4&|D>3oJIxBwGh|YT)%;7i@$+U`p15+zww&ELI42Yzzg{I{TkZX8~@yJ zP^_|S7c)lC4!P-XS_R zxLQp`Qp8Giuyg_>F}#l|$6ZY>tPp!S z{pxDb9n72;Yd;1aC=dq$H6ktDjA8?Q+9Wwqhmw#F;^doB`Jw4|Z%4%?w|BVRP7fL1 z?gWP>{BSk+!n8QsT+g(!_L`LfD9nsoSb5xzkT0hP(lP^daeED*qjfF$hr`LbVhqjd ztZCyhkeKG|q)Ue=SVa7+U+| z+Op?vVMWk*Y?qgi)z6w4UxUPF)TVG#K`ZpDYG-%5xyeg)i@u3TDPR8quLPJT>5JSc zOgL6#KHhYVQD@JK?t{#T!39TlE4;Oh6IbrKp~-Mt0_Zj6=8VqtGt0I-VfflyvvH&O zi-n5Vf|AHric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f?y$UjISyh2Tc|h4NRq@b^0GDaz9_;}1$KIAa1U z^B2nhC_0`3K27!i0O~z|s@%UO{!am)Cfk1i8NfUb-r;|x-cJ#prh$JDX27E^Fv6dt z@Tut2@cBn{9y~z#TQGep_%s~-5$ph04B&hIo%WszKjq3l!f&vC3I7k~e2Vjwj{e|C eU;_aELQYDuFyQgf&tw@HUNa0RIPG?R^LU literal 0 HcmV?d00001 diff --git a/using_pip_openpyxl.py b/using_pip_openpyxl.py index 730a747..94fcd96 100644 --- a/using_pip_openpyxl.py +++ b/using_pip_openpyxl.py @@ -1,4 +1,12 @@ +# Will make an exercise on this. need to apply 10% discount on all the values under C column. +# Also need to make a chart once done. +# This is just a practice to familiarize myself with the Python packages available on the Python Package Index. +# I clearly need to delve much deeper into a specific Python package if I want to familiarize +# myself with its available functionalities + import openpyxl as xl +from openpyxl.chart import BarChart, Reference + wb = xl.load_workbook("transactions.xlsx") sheet = wb['Sheet1'] cell = sheet.cell(1, 1) @@ -13,5 +21,16 @@ print("will reiterate the contents of C2 to C4 cells below:") for row in range(2, max_row + 1): - cell = sheet.cell(row, 3) - print(cell.value) + cell_column_c = sheet.cell(row, 3) + discounted_price = cell_column_c.value * .90 + cell_column_d = sheet.cell(row, 4) + cell_column_d.value = discounted_price + +ref_values = Reference(sheet, min_row=2, max_row=sheet.max_row, min_col=4, max_col=4) + +chart = BarChart() +chart.add_data(ref_values) +sheet.add_chart(chart, 'e2') + +wb.save('transactions2.xlsx') +print("Saved on transactions2.xlsx")