아미(아름다운미소)

python excel 셀에 컬러 입히기 본문

랭귀지/PYTHON

python excel 셀에 컬러 입히기

유키공 2018. 9. 10. 08:30

python excel 셀에 컬러 입히기

# -*- coding: utf-8 -*- 
'''
Created on 2018. 9. 6.

@author: bhm
'''
import win32com.client

excel = win32com.client.Dispatch("Excel.Application")
excel.Visible = True
wb = excel.Workbooks.Open('C:\\Users\\bhm\\Desktop\\input.xlsx')
ws = wb.ActiveSheet
ws.Cells(1,2).Value = "is"
ws.Range("C1").Value = "good"
ws.Range("C1").Interior.ColorIndex = 10
ws.Range("A2:C2").Interior.ColorIndex = 24
ws = wb.ActiveSheet
excel.Quit()

Comments