Coder Social home page Coder Social logo

excel2img's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

excel2img's Issues

Pivot Chart Range

Hi,

Was using excel2img for saving pivot charts in excel to image .png format. My doubt is my pivot table and pivot charts both are on the same sheets. When I execute below statement:

ex.export_img('foo.xlsm', 'customer.png', 'customer_pivot', None)

An image is generated with only pivot table. Pivot chart is not saved as image. So kindly help we with this as I want to know how I can loop over above code to save different charts in my xlsx file.

Thanks in advance.
Regards,
Husain. S.

Issue with cyrillic sheet name

I have xlsx file with one sheet - "Известие-2".
by default its raise error
Failed locating range Известие-2!A1:O38
but when i simple rename sheet to "Известие" - all works

Error when use excel2img

I got this error when converting a sheets

excel2img.export_img("t956.xlsx",'image.png','Sheet1!C3:J26')
Traceback (most recent call last):
File "G:\Install Location\Python\Python38-32\lib\site-packages\excel2img\excel2img.py", line 88, in export_img
rng = excel.workbook.Sheets(page).UsedRange
File "C:\Users\ARI\AppData\Local\Temp\gen_py\3.8\00020813-0000-0000-C000-000000000046x0x1x6\Sheets.py", line 113, in call
ret = self.oleobj.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),Index
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352565), None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "G:\Install Location\Python\Python38-32\lib\site-packages\excel2img\excel2img.py", line 90, in export_img
raise Exception("Failed locating used cell range on page %s"%page)
Exception: Failed locating used cell range on page Sheet1!C3:J26

AttributeError: 'NoneType' object has no attribute 'save'

This is the first time I'm using excel2img and see below error every time I run it
Python version: 3.8.2

Traceback (most recent call last):
File "C:\Users\Admin\Desktop\Python\DailyWhatsAppSummaryAutomation\DailySummary.py", line 37, in
excel2img.export_img("Master.xls", "Master.png", "Sheet1", "A1:B5")
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\excel2img\excel2img.py", line 122, in export_img
im.save(fn_image, fn_image[-3:])
AttributeError: 'NoneType' object has no attribute 'save'

Converting is very slow

I have 10 sheets in workbook. Converting takes more than 2 minutes. Does it support multithread conversion?

Chart Image has white borders

When trying to export a range of cells that contain a chart, the image chart cames with two white borders as shown in the image

test

The script is simply:

import excel2img

# Save as PNG the range of used cells in test.xlsx on page named "Sheet1"
excel2img.export_img("template.xlsx", "test.png", "Sheet1", "Sheet1!F2:M17")

The excel file is like this:
Excel

I even tried to put white background, without borders and make the chart surpass a little the cells, but that two borders came anyway.

Beep after every screenshot

Hello the tool works great, but after every saved image, a "beep" sound is played.
Is there any possibility to deactivate that sound?

Patrick

excel2img installation on Python 3.8 on win10

Having difficulty installing the excel2img on win10 running python 3.8-32

did the followings:
1- python3 -m pip install --upgrade pip
2- python3 -m pip install --upgrade Pillow

3- installing excel2img, by invoking "pip install excel2img", getting into this issue :
Collecting pywin32>=223 (from pypiwin32->excel2img)
Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32->excel2img) (from versions: )
No matching distribution found for pywin32>=223 (from pypiwin32->excel2img)

What could be the issue ? did pip install win32, to ensure pywin32 needed, but seems pywin32 is builtin Python 3.8

Thanks
Matthew

AttributeError: module 'excel2img' has no attribute 'export_img'

Hi

# python3 excel2img.py
Traceback (most recent call last):
  File "excel2img.py", line 1, in <module>
	import excel2img
  File "/home/ali/git_proj/test/excel2img.py", line 5, in <module>
	excel2img.export_img("test.xlsx", "test.png", "Sheet1", None)
AttributeError: module 'excel2img' has no attribute 'export_img'

Not support image name of '.jpg'

Traceback (most recent call last):
File "D:\tools\Python310\lib\tkinter_init_.py", line 1921, in call
return self.func(*args)
File "E:\work\study\pythonWorkspace\excel2image\app.py", line 43, in do_convert
convertExcelToImg.convert_excel_to_image(excel_files, range_names)
File "E:\work\study\pythonWorkspace\excel2image\convertExcelToImg.py", line 67, in convert_excel_to_image
excel2img.export_img(excel_files[i], img_save + image_name + ".jpg", sheet_name, range_names[i])
File "E:\work\study\pythonWorkspace\excel2image\venv\lib\site-packages\excel2img\excel2img.py", line 122, in export_img
im.save(fn_image, fn_image[-3:])
File "E:\work\study\pythonWorkspace\excel2image\venv\lib\site-packages\PIL\Image.py", line 2418, in save
save_handler = SAVE[format.upper()]
KeyError: 'JPG'

Does not see the xlsx file while using the telegram bot

Good afternoon, I use this library to process the excel file and send it to the telegram chat. If you run a script with a telegram bot (a script is run from it to create an image), everything works correctly, but if the telegram bot is running in the background, then an error occurs.

Failed to open C:\Users\admin\Desktop\Work\Parser\Telegram_AUTO\Rating\Листы ожидания (отмененные записи КР) 2024-03-25_12.06.xlsx

Строка кода:
excel2img.export_img(save_path, photo_screan1, "Свод Взрослые", None)

Object has no attribute 'parent'

I am currently working on a Python script that saves screenshots from an Excel file using the excel2image module.

My code is pretty easy:

import excel2img excel2img.export_img(Workpath + "/" + "CB_TEMP.xlsx", "alarm_BB1.png", "Deckblatt", "A2:C20")

Unfortunately I always get the following error message:

`Unfortunately I always get the following error message:


AttributeError Traceback (most recent call last)
in
----> 1 excel2img.export_img(Workpath + "/" + "CB_TEMP.xlsx", "alarm_BB1.png", "Deckblatt", "A2:C20")

~\anaconda3\lib\site-packages\excel2img\excel2img.py in export_img(fn_excel, fn_image, page, _range)
111
112 # See http://stackoverflow.com/a/42465354/1924207
--> 113 for shape in rng.parent.Shapes: pass
114
115 xlScreen, xlPrinter = 1, 2

~\anaconda3\lib\site-packages\win32com\client_init_.py in getattr(self, attr)
471 args=self.prop_map_get.get(attr)
472 if args is None:
--> 473 raise AttributeError("'%s' object has no attribute '%s'" % (repr(self), attr))
474 return self.ApplyTypes(*args)
475

AttributeError: '<win32com.gen_py.Microsoft Excel 16.0 Object Library.Range instance at 0x2460934736048>' object has no attribute 'parent'`

I have already tried several workarounds but I can't get it to work. Sometimes it works like magic, but mostly only after a reboot and deleting the data in C:/Users/patrick/AppData/Temp/gen_py.

I have a feeling something is clashing in the code with the win32com module I use in a function before to convert an XLSB file to an XLSX file:

def ConvertExcel(excel_filepath, Workpath): excel = win32com.client.gencache.EnsureDispatch('Excel.Application') xlsb_doc = excel.Workbooks.Open(os.path.abspath(excel_filepath)) excel_sheets = os.path.abspath(Workpath) + "\\CB_TEMP.xlsx" xlsb_doc.SaveAs(excel_sheets, 51) xlsb_doc.Close() excel.Quit() del excel return excel_sheets

Kind regards,
Patrick

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.