python 将Excel格式转换成HTML格式

import codecs
import pandas as pd
xd = pd.ExcelFile('XXX.xls')
pd.set_option('display.max_colwidth',1000)#设置列的宽度,以防止出现省略号
df = xd.parse()
with codecs.open('XX.html','w') as html_file:
    html_file.write(df.to_html(header = True,index = False))

 

posted on 2018-11-26 11:03  oohy  阅读(6631)  评论(0编辑  收藏  举报