Python实现将Excel转换成为image

714 篇文章 ¥9.90 ¥99.00
本文介绍了一种通过Python将Excel文件转换成图片的方法,主要思路是先将Excel转换为Html,然后再将Html转为Image。代码实现过程详细阐述了这一转换过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我的主要思路是:

Excel -> Html -> Image

代码如下:

# -*- coding:utf-8 -*-
__author__ = 'YangXin'
import sys
import pandas as pd
import codecs
import imgkit
reload(sys)
sys.setdefaultencoding('utf-8')


# ReportImage -> report convert include multiple sheets into pictures
class ReportImage:

    def __init__(self):
        pass

    # excel_html -> convert excel include multiple sheets into multiple html file
    # excel_file -> file
    # html_path  -> path
    @staticmethod
    def excel_html(excel_file, html_path):
        html_list = []
        excel_obj = pd.ExcelFile(excel_file)
        sheet_list = excel_obj.sheet_names
        index = 0
        for i in sheet_list:
            html_file = html_path + i + ".h
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

杨鑫newlfe

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值