ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] python xlwings °j°é³]©w½Ð±Ð

[µo°Ý] python xlwings °j°é³]©w½Ð±Ð

³z¹Lxlwings  ¥i¥HŪ¨ú¨ì¨â­ÓsheetÄæ¦ì¼Æ­È
¦pªG­n¾ãÄæ¦ì³£¶]§¹¡A°j°é¤W­n«ç»ò³]­p©O?(ex:B2->BMaxÄæ¦ì)

import xlwings as xw #¾É¤JXlwings module
import pandas as pd  
app=xw.App(visible=True,add_book=False)
app.display_alerts=False   #Ãö³¬Excel´£¥Ü®Ø
app.screen_updating=True  #False 关闭«Ì¹õ§ó·s,¥i¥[§Ö§»ªº执¦æ³t«×,¬Ý¤£¨£sheet¤º®e
#Àɮצì¸m:filepath¡A¥´¶}ÀɮסA«O¦s¡AÃö³¬¡Aµ²§ôµ{¦¡
filepath=r'C:\Users\test.xlsx'
wb=app.books.open(filepath)

a=wb.sheets['sheet1'].range('B2').value
b=wb.sheets['sheet2'].range('B2').value
c=wb.sheets['sheet1'].range('P2').value
d=wb.sheets['sheet2'].range('P2').value
e=wb.sheets['sheet2'].range('Q2').value
f=wb.sheets['sheet2'].range('V2').value
if a==b and d=="Passed":   
    wb.sheets['sheet1'].range('P2').value='Passed'
    wb.sheets['sheet1'].range('Q2').value=e
    wb.sheets['sheet1'].range('V2').value=f
if  a==b and d=="Failed":
    wb.sheets['sheet1'].range('P2').value='Failed'
    wb.sheets['sheet1'].range('Q2').value=e
    wb.sheets['sheet1'].range('V2').value=f
if a==b and d=="Blocked":
    wb.sheets['sheet1'].range('P2').value='Blocked'
    wb.sheets['sheet1'].range('Q2').value=e
    wb.sheets['sheet1'].range('V2').value=f
if a==b and d=="Exempted":
    wb.sheets['sheet1'].range('P2').value='Exempted'
    wb.sheets['sheet1'].range('Q2').value=e
    wb.sheets['sheet1'].range('V2').value=f   
print(a,b,c,d,e,f)
#wb.save()
#wb.close()
#app.quit()

        ÀR«ä¦Û¦b : ¤f»¡¤@¥y¦n¸Ü¡A¦p¤f¥X½¬ªá¡F¤f»¡¤@¥yÃa¸Ü¦p¤f¦R¬r³D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD