[Python] XlsxWriter - Excel 다루기

Jen Y·2021년 8월 5일
0

Python

목록 보기
14/17
writer = pd.ExcelWriter(out_file, engine='xlsxwriter')
df.to_excel(writer, sheet_name='Sheet1', freeze_panes = (1, 0), index=False)

workbook = writer.book
worksheet = writer.sheets['Sheet1']
worksheet.set_zoom(80) # zoom 설정

# row, col, width, format
worksheet.set_column(0, 0, 10, workbook.add_format({'num_format': '#,##0', 'border': 1, 'align': 'center', 'text_wrap': True}))

(max_row, max_col) = df.shape
# 필터 추가
worksheet.autofilter(0, 0, max_row, 5)

# 3열에 필터 걸기 worksheet.filter_column_list(3, ['one', 'two'])

writer.save()

눈금선

worksheet.hide_gridlines(2)

0개의 댓글