unote 書けば書くほどに

pip install pyinstaller

PythonのスクリプトをPyinstallerでexe化する方法 - TECH PLAY Magazine


import openpyxl as px

filepath = 'Sample.xlsx'
wb = px.load_workbook(filename=filepath)
ws91 = wb['Sheet9_1']
ws92 = wb['Sheet9_2']

lastrow91 = ws91.max_row
lastrow92 = ws92.max_row

for i in range(2, lastrow91 + 1):
product_code = ws91['B' + str(i)].value
str1 = str(ws91['A' + str(i)].value)
# プログラム5|シート9_2の商品コードとマッチング
for k in range(2, lastrow92 + 1):
master_code = ws92['B' + str(k)].value
str2 = str(ws92['A' + str(k)].value)
if product_code is None:
print("Product is none")
break

# 合致した行の値を取得、連結動作
if product_code == master_code:
if (product_code + str1) == (master_code + str2):
product_name = ws92['B' + str(k)].value
product_price = ws92['C' + str(k)].value

# プログラム7|シート9_1に入力
ws91['E' + str(i)].value = product_name
ws91['F' + str(i)].value = product_price
ws91['G' + str(i)].value = product_price * \
ws91['D' + str(i)].value

break

# プログラム8|ファイル保存
wb.save('Sample9.xlsx')