xlwings와 pandas로 Excel 스크립팅 마스터
수업 보충자료입니다. import xlwings as xw import pandas as pd import numpy as np class XL : def __init__ ( self , fname ): self .wb=xw.Book(fname) def get_sheet ( self , sname = 'Sheet1' ): return self .wb.sheets[sname] def get_records ( self , sname = 'Sheet1' , corner = 'A1' ): sht= self .get_sheet(sname) return sht.range(corner).options(pd.DataFrame, expand = 'table' , index = False , header = True ).value def write_records ( self , df , sname = 'Sheet1' , corner = 'A1' ): sht= self .get_sheet(sname) sht.range(corner).options( index = False ).value=df def write_col ( self , data , corner , sname = 'Sheet1' ): sht= self .get_sheet(sname) sht.range(corner).options(pd.Series, index = False ).value=pd.Series(data)