-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInv_2Rough.py
127 lines (99 loc) · 4.74 KB
/
Inv_2Rough.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import openpyxl
from openpyxl import cell
inv_temp_wb = openpyxl.load_workbook("Source/invoice template.xlsx")
# inv_temp_wb.save('C:\\Users\\panka\\OneDrive\\Desktop\\Abcd.xlsx')
# Iterating column and row wise in invoice template
ws = inv_temp_wb["Invoice"]
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
# print("Sheet",j.value)
if j.value == "Customer ID":
# Cell D9 will be the cell in which value of Customer ID will be enter for a customer.
D9 = ws.cell(row=j.row, column=j.column+1)
print(D9)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Customer Name":
# Cell D10 will be the cell in which value of Customer Name will be enter for a customer.
D10 = ws.cell(row=j.row, column=j.column+1)
print(D10)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Segment":
# Cell D11 will be the cell in which value of Segment will be enter for a customer.
D11 = ws.cell(row=j.row, column=j.column+1)
print(D11)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Address":
# Cell D12 will be the cell in Address will be enter for a customer.
D12 = ws.cell(row=j.row, column=j.column+1)
print(D12)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Order Details":
# Cell D15 will be the cell in which Order Details will be enter for a customer.
D15 = ws.cell(row=j.row, column=j.column+1)
print(D15)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Order ID":
# Cell M9 will be the cell in which Order ID will be enter for a customer.
M9 = ws.cell(row=j.row, column=j.column+1)
print(M9)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Order Date":
# Cell M10 will be the cell in which Order Date will be enter for a customer.
M10 = ws.cell(row=j.row, column=j.column+1)
print(M10)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Ship Date":
# Cell M11 will be the cell in which Ship Date will be enter for a customer.
M11 = ws.cell(row=j.row, column=j.column+1)
print(M11)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Product ID":
# Cell C18 will be the cell in which Product ID will be enter for a customer.
C18 = ws.cell(row=j.row+1, column=j.column)
print(C18)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Product Name":
# Cell D18 will be the cell in which Product Name will be enter for a customer.
D18 = ws.cell(row=j.row+1, column=j.column)
print(D18)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Unit Price":
# Cell E18 will be the cell in which Unit Price will be enter for a customer.
E18 = ws.cell(row=j.row+1, column=j.column)
print(E18)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Quantity":
# Cell F18 will be the cell in which Quantity will be enter for a customer.
F18 = ws.cell(row=j.row+1, column=j.column)
print(F18)
# print(j)
for i in ws.iter_rows(min_row=1, max_row=ws.max_row, min_col=1, max_col=ws.max_column):
for j in i:
if j.value == "Price":
# Cell F18 will be the cell in which Price will be enter for a customer.
F18 = ws.cell(row=j.row+1, column=j.column)
print(F18)
# print(j)
# I will be converting this into a function in Inv_3Rough.py