# Pip install openpyxl - error

**URL:** <https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348>\
**Category:** Ignition\
**Created:** [November 2, 2023, 5:07am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348 "2023-11-02T05:07:02Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [November 2, 2023, 5:07am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/1 "2023-11-02T05:07:02Z")

</div>

How to install openpyxl in ignition?

i can't able install

can any one help me out

---

<div class="post-metadata">

**Author:** ![Aizhigit\_Mussali](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Aizhigit\_Mussali](https://forum.inductiveautomation.com/u/Aizhigit_Mussali)\
**Post date:** [November 2, 2023, 5:24am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/2 "2023-11-02T05:24:36Z")

</div>

Here is the guide for [Importing and using 3rd party Python libraries in Ignition – Inductive Automation Help Center](https://support.inductiveautomation.com/hc/en-us/articles/360047136012-Importing-and-using-3rd-party-Python-libraries-in-Ignition)

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [November 2, 2023, 5:38am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/3 "2023-11-02T05:38:12Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/a/ca1e52849b4d2a99104b9096014c4ba33eeae9a6.png)  
its there but  
from openpyxl import Workbook

error  
ImportError: No module named openpyxl

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 2, 2023, 5:49am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/4 "2023-11-02T05:49:15Z")

</div>

Try

```auto
from openpyxl import workbook

```

Remember case matters in Python

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [November 2, 2023, 6:25am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/5 "2023-11-02T06:25:58Z")

</div>

`from openpyxl import workbook`

same error  
Traceback (most recent call last):  
File "", line 1, in   
ImportError: No module named openpyxl

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 2, 2023, 9:48am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/6 "2023-11-02T09:48:07Z")

</div>

Did you restart the designer?

Also, there is already the Apache POI libraries installed. Why not use them?

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [November 2, 2023, 10:01am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/7 "2023-11-02T10:01:52Z")

</div>

yes restarted still same error

ask me to call like this

from openpyxl import Workbook  
import Workbook

tired both same error

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 2, 2023, 10:04am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/8 "2023-11-02T10:04:14Z")

</div>

> [@Using Openpyxl 3rd party python library](https://forum.inductiveautomation.com/t/using-openpyxl-3rd-party-python-library/32785/3):
>
> Latest version of openpyxl doesn’t support python 2.7. I downloaded the last version that supports it and am using it successfully - version 2.6.4. Only issue is that is uses SAX XML parser, which isn’t available in Vision, only in Designer. So, having to run scripts on Gateway instead of Client.

> [@JordanCClark](#):
>
> Also, there is already the Apache POI libraries installed. Why not use them?

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [November 2, 2023, 10:08am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/9 "2023-11-02T10:08:50Z")

</div>

ok understood

this is what i am trying to do

i have easy chart

Is it possible take a screenshot of easy chart and put it in excel sheet automatically

any idea?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 2, 2023, 12:27pm UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/10 "2023-11-02T12:27:47Z")

</div>

You will find this [system.print.printToImage - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.print.printToImage)

and this

> <https://stackoverflow.com/questions/10888969/insert-image-in-openpyxl>

Helpful, but no one here is or can code it for you. Give it your best shot and if you get errors feel free to ask about them but these two should get you started.

The above is assuming if you're using Vision. If you're using perspective - I don't know that you can take screenshots, but maybe someone else can chime in.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 2, 2023, 12:47pm UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/11 "2023-11-02T12:47:16Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/a/aac6fd7d48fabd9270cf4641f814efb86fba13d9.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/a/fa55e761ce336195bba4c59c355f8a8dd00b5005.png)

Script on the button. I'd recommend breaking this out into a project script or two for use in production.

```python
from java.awt.image import BufferedImage
from org.apache.poi.util import IOUtils
from javax.imageio import ImageIO
from org.apache.poi.ss.usermodel import Cell
from org.apache.poi.ss.usermodel import Row 
from org.apache.poi.ss.usermodel import Sheet 
from org.apache.poi.ss.usermodel import Workbook 
from org.apache.poi.xssf.usermodel import XSSFWorkbook
from org.apache.poi.xssf.usermodel import XSSFDataFormat
from org.apache.poi.xssf.usermodel import XSSFClientAnchor
from org.apache.poi.ss.usermodel.ClientAnchor import AnchorType

from java.io import FileOutputStream, ByteArrayOutputStream

component = event.source.parent.getComponent('Easy Chart')

# Create a captrue of the component and get its byte array
image = BufferedImage(component.getWidth(),
                      component.getHeight(),
                      BufferedImage.TYPE_INT_RGB
                     )
component.paint(image.getGraphics())
baos = ByteArrayOutputStream()
ImageIO.write(image, 'png', baos)
imageBytes = baos.toByteArray()

# Create workbook
wb = XSSFWorkbook()

# Create Sheet
sheet = wb.createSheet('Easy Chart')

# Add the image to the workbook
imageId = wb.addPicture(imageBytes, Workbook.PICTURE_TYPE_PNG)

# Create the drawing patriarch. We need this to draw the image on the sheet.
drawing = sheet.createDrawingPatriarch()

# Create an anchor. The anchor is where the image will go.
anchor = XSSFClientAnchor()
anchor.setAnchorType(AnchorType.DONT_MOVE_AND_RESIZE)
# set anchor location to B2
anchor.setCol1(1)
anchor.setRow1(1)

# Draw the image and return the picture object
picture = drawing.createPicture(anchor, imageId)
# Put the picture back to it's orignal size
picture.resize()

# Write the excel file
output = FileOutputStream('c:/test/easyChart.xlsx')
wb.write(output)
output.close()

```

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 2, 2023, 12:50pm UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/12 "2023-11-02T12:50:46Z")

</div>

Couldn't help yourself huh? lol. I think here -

```auto
image = BufferedImage(component.getWidth(),
                      component.getHeight(),
                      BufferedImage.TYPE_INT_RGB
                     )

```

you may be able to use [system.print.createImage](https://docs.inductiveautomation.com/display/DOC81/system.print.createImage), feed a component get a BufferedImage of it back, but it's not saving you much code wise and you may want the ability to specify height/width manually.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 2, 2023, 12:53pm UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/13 "2023-11-02T12:53:15Z")

</div>

Had a quiet moment between meetings. And, I'm all about dat flexibity.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 2, 2023, 12:53pm UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/14 "2023-11-02T12:53:44Z")

</div>

Now lets just hope he is using vision!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 2, 2023, 12:54pm UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/15 "2023-11-02T12:54:36Z")

</div>

> [@bkarabinchak.psi](#):
>
> using vision!

The OP called out the Easy Chart.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [November 3, 2023, 5:22am UTC](https://forum.inductiveautomation.com/t/pip-install-openpyxl-error/81348/16 "2023-11-03T05:22:18Z")

</div>

Yes i am using vision
