xlsxwriter Excel 파일 쓰기

1245 단어
#coding=utf-8
import xlsxwriter # 
myWorkbook = xlsxwriter.Workbook(opath+'/'+file_realname+'_pre.xlsx')# excel 
sheet_file_realname = myWorkbook.add_worksheet(file_realname_new)# file_realname_new sheet, sheet1
bold= myWorkbook.add_format({'bold':True})# --- 
##
# workfomat = workbook.add_format({
# 'bold' : True, #
# 'border' : 1, #
# 'align' : 'center', #
# 'valign' : 'vcenter', #
# 'fg_color' : '#F4B084', #
# })
para_1 = 10
para_2 = 20

sheet_file_realname.write(0, 0, para_1, bold) # ,
sheet_file_realname.write(0, 1, para_2, bold)
sheet_file_realname.write(0, 2, 'good', bold) #
sheet_file_realname.write(0, 3, 'people', bold)
sheet_file_realname.write(0, 4, 'hello', bold)

# sheet_file_realname.write('A1',22) # , excel 'A1','B1'

myWorkbook.close() #

:https://xlsxwriter.readthedocs.io/

좋은 웹페이지 즐겨찾기