컴퓨터/Python
win32com 수식을 값으로 붙여넣기
풍경소리^^
2019. 6. 12. 17:36
import win32com.client
excel = win32com.client.Dispatch("Excel.Application")
excel.Visible = True
wb = excel.Workbooks.Open(r"D:\git\python\win32com\test.xlsx")
ws = wb.Worksheets(1)
ws = wb.ActiveSheet
ws.Range("f2:f7").Formula='=sum(a2:e2)'
ws.Range("f2:f7").Value=ws.Range("f2:f7").Value
# ws.Cells(2,6).Font.Size=16
ws.Range("f2:f7").Font.Size=16
# ws.Cells(2,6).Interior.colorIndex=6
ws.Range("f2:f7").Interior.colorIndex=6
wb.Save()
wb.Close()
excel.Quit()