python pandas实现excel转为html格式
import codecs
import pandas as pd
xd = pd.ExcelFile('./20200325北京消息计费系统日报.xlsx')
pd.set_option('display.max_colwidth',1000)#设置列的宽度,以防止出现省略号
df = xd.parse()
with codecs.open('20200325北京消息计费系统日报.html','w',encoding='utf-8') as html_file:
html_file.write("" + '\n')
html_file.write("" + '\n')
html_file.write(df.to_html(header = True,index = False))
html_file.write("")
还可以设置css样式 可参考https://www.cnblogs.com/xiao987334176/p/14138883.html