How to get image from xlsx fileHow to merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How can I safely create a nested directory in Python?How to get the current time in PythonLazy load of images in ListViewHow do I sort a dictionary by value?How do I get the number of elements in a list in Python?How do I list all files of a directory?How to read a file line-by-line into a list?

Is there enough fresh water in the world to eradicate the drinking water crisis?

What will be the benefits of Brexit?

How to color a zone in Tikz

Why are all the doors on Ferenginar (the Ferengi home world) far shorter than the average Ferengi?

What does the "3am" section means in manpages?

Simple image editor tool to draw a simple box/rectangle in an existing image

How can a jailer prevent the Forge Cleric's Artisan's Blessing from being used?

The One-Electron Universe postulate is true - what simple change can I make to change the whole universe?

What if somebody invests in my application?

Why isn't KTEX's runway designation 10/28 instead of 9/27?

Resetting two CD4017 counters simultaneously, only one resets

Invariance of results when scaling explanatory variables in logistic regression, is there a proof?

Can I create an upright 7-foot × 5-foot wall with the Minor Illusion spell?

Is there an Impartial Brexit Deal comparison site?

Can I rely on these GitHub repository files?

How to check participants in at events?

Teaching indefinite integrals that require special-casing

In Star Trek IV, why did the Bounty go back to a time when whales were already rare?

Hostile work environment after whistle-blowing on coworker and our boss. What do I do?

No idea how to draw this using tikz

Can a Bard use an arcane focus?

Can the electrostatic force be infinite in magnitude?

Proving by induction of n. Is this correct until this point?

How can I raise concerns with a new DM about XP splitting?



How to get image from xlsx file


How to merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How can I safely create a nested directory in Python?How to get the current time in PythonLazy load of images in ListViewHow do I sort a dictionary by value?How do I get the number of elements in a list in Python?How do I list all files of a directory?How to read a file line-by-line into a list?













0















I have some problems with getting image from xlsx file. The problem is that image is not located in specific cell. When I click on it, it's name is Picture 1 and that's it.



How can I get this image to put it in some other file?
I've already tried to extract the xlsx file with archivator and get images, but this method not satisfied me.



This is example code of trying to add the picture from xlsx file to docx file:



from openpyxl import load_workbook
from docx import Document

my_xlsx_file = 'C:UserspankovDesktopmy_xlsx_file.xlsx'
parameter_name = 'A2D3RWSS_356'
my_doc_file = 'test_doc.docx'
document = Document(my_doc_file)

wb = load_workbook(my_xlsx_file)
ws = wb[parameter_name]

for image in ws._images:
document.add_picture(image.path)

document.save(my_doc_file)


Gives me error:
IOError: [Errno 2] No such file or directory: '/xl/media/image1.png










share|improve this question
























  • 1) Show your code. 2) What do you mean by "get"? Extract image?

    – Alderven
    Mar 7 at 10:20











  • Yes, extract image. I have xlsx document with multiple sheets and image in every sheet. Sheet's names are parameter name(for example "A2D_39CCA"). On the other side I have .docx document with all of these parameters in it, and every parameter is on new page. I need to search in .xlsx file for every single parameter, go to the sheet which name is this parameter name, get the image and put it in .docx file.

    – unreax
    Mar 7 at 11:18












  • Images are attached to worksheets and not cells.

    – Charlie Clark
    Mar 7 at 12:05











  • Okay, I've tried also: for image in ws._images: document.add_picture(image.path) But gives me: IOError: [Errno 2] No such file or directory: '/xl/media/image1.png'

    – unreax
    Mar 7 at 12:09







  • 2





    The path on an image is the virtual path inside the zip, so you cannot use that. There is a _data method on image which is supposed to give you back png bytes, maybe you can write them to a file and then construct a new image to import into the Document (or view the .png file)

    – eckes
    Mar 7 at 12:31















0















I have some problems with getting image from xlsx file. The problem is that image is not located in specific cell. When I click on it, it's name is Picture 1 and that's it.



How can I get this image to put it in some other file?
I've already tried to extract the xlsx file with archivator and get images, but this method not satisfied me.



This is example code of trying to add the picture from xlsx file to docx file:



from openpyxl import load_workbook
from docx import Document

my_xlsx_file = 'C:UserspankovDesktopmy_xlsx_file.xlsx'
parameter_name = 'A2D3RWSS_356'
my_doc_file = 'test_doc.docx'
document = Document(my_doc_file)

wb = load_workbook(my_xlsx_file)
ws = wb[parameter_name]

for image in ws._images:
document.add_picture(image.path)

document.save(my_doc_file)


Gives me error:
IOError: [Errno 2] No such file or directory: '/xl/media/image1.png










share|improve this question
























  • 1) Show your code. 2) What do you mean by "get"? Extract image?

    – Alderven
    Mar 7 at 10:20











  • Yes, extract image. I have xlsx document with multiple sheets and image in every sheet. Sheet's names are parameter name(for example "A2D_39CCA"). On the other side I have .docx document with all of these parameters in it, and every parameter is on new page. I need to search in .xlsx file for every single parameter, go to the sheet which name is this parameter name, get the image and put it in .docx file.

    – unreax
    Mar 7 at 11:18












  • Images are attached to worksheets and not cells.

    – Charlie Clark
    Mar 7 at 12:05











  • Okay, I've tried also: for image in ws._images: document.add_picture(image.path) But gives me: IOError: [Errno 2] No such file or directory: '/xl/media/image1.png'

    – unreax
    Mar 7 at 12:09







  • 2





    The path on an image is the virtual path inside the zip, so you cannot use that. There is a _data method on image which is supposed to give you back png bytes, maybe you can write them to a file and then construct a new image to import into the Document (or view the .png file)

    – eckes
    Mar 7 at 12:31













0












0








0








I have some problems with getting image from xlsx file. The problem is that image is not located in specific cell. When I click on it, it's name is Picture 1 and that's it.



How can I get this image to put it in some other file?
I've already tried to extract the xlsx file with archivator and get images, but this method not satisfied me.



This is example code of trying to add the picture from xlsx file to docx file:



from openpyxl import load_workbook
from docx import Document

my_xlsx_file = 'C:UserspankovDesktopmy_xlsx_file.xlsx'
parameter_name = 'A2D3RWSS_356'
my_doc_file = 'test_doc.docx'
document = Document(my_doc_file)

wb = load_workbook(my_xlsx_file)
ws = wb[parameter_name]

for image in ws._images:
document.add_picture(image.path)

document.save(my_doc_file)


Gives me error:
IOError: [Errno 2] No such file or directory: '/xl/media/image1.png










share|improve this question
















I have some problems with getting image from xlsx file. The problem is that image is not located in specific cell. When I click on it, it's name is Picture 1 and that's it.



How can I get this image to put it in some other file?
I've already tried to extract the xlsx file with archivator and get images, but this method not satisfied me.



This is example code of trying to add the picture from xlsx file to docx file:



from openpyxl import load_workbook
from docx import Document

my_xlsx_file = 'C:UserspankovDesktopmy_xlsx_file.xlsx'
parameter_name = 'A2D3RWSS_356'
my_doc_file = 'test_doc.docx'
document = Document(my_doc_file)

wb = load_workbook(my_xlsx_file)
ws = wb[parameter_name]

for image in ws._images:
document.add_picture(image.path)

document.save(my_doc_file)


Gives me error:
IOError: [Errno 2] No such file or directory: '/xl/media/image1.png







python image get extract openpyxl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 11 at 6:30







unreax

















asked Mar 7 at 10:13









unreaxunreax

11




11












  • 1) Show your code. 2) What do you mean by "get"? Extract image?

    – Alderven
    Mar 7 at 10:20











  • Yes, extract image. I have xlsx document with multiple sheets and image in every sheet. Sheet's names are parameter name(for example "A2D_39CCA"). On the other side I have .docx document with all of these parameters in it, and every parameter is on new page. I need to search in .xlsx file for every single parameter, go to the sheet which name is this parameter name, get the image and put it in .docx file.

    – unreax
    Mar 7 at 11:18












  • Images are attached to worksheets and not cells.

    – Charlie Clark
    Mar 7 at 12:05











  • Okay, I've tried also: for image in ws._images: document.add_picture(image.path) But gives me: IOError: [Errno 2] No such file or directory: '/xl/media/image1.png'

    – unreax
    Mar 7 at 12:09







  • 2





    The path on an image is the virtual path inside the zip, so you cannot use that. There is a _data method on image which is supposed to give you back png bytes, maybe you can write them to a file and then construct a new image to import into the Document (or view the .png file)

    – eckes
    Mar 7 at 12:31

















  • 1) Show your code. 2) What do you mean by "get"? Extract image?

    – Alderven
    Mar 7 at 10:20











  • Yes, extract image. I have xlsx document with multiple sheets and image in every sheet. Sheet's names are parameter name(for example "A2D_39CCA"). On the other side I have .docx document with all of these parameters in it, and every parameter is on new page. I need to search in .xlsx file for every single parameter, go to the sheet which name is this parameter name, get the image and put it in .docx file.

    – unreax
    Mar 7 at 11:18












  • Images are attached to worksheets and not cells.

    – Charlie Clark
    Mar 7 at 12:05











  • Okay, I've tried also: for image in ws._images: document.add_picture(image.path) But gives me: IOError: [Errno 2] No such file or directory: '/xl/media/image1.png'

    – unreax
    Mar 7 at 12:09







  • 2





    The path on an image is the virtual path inside the zip, so you cannot use that. There is a _data method on image which is supposed to give you back png bytes, maybe you can write them to a file and then construct a new image to import into the Document (or view the .png file)

    – eckes
    Mar 7 at 12:31
















1) Show your code. 2) What do you mean by "get"? Extract image?

– Alderven
Mar 7 at 10:20





1) Show your code. 2) What do you mean by "get"? Extract image?

– Alderven
Mar 7 at 10:20













Yes, extract image. I have xlsx document with multiple sheets and image in every sheet. Sheet's names are parameter name(for example "A2D_39CCA"). On the other side I have .docx document with all of these parameters in it, and every parameter is on new page. I need to search in .xlsx file for every single parameter, go to the sheet which name is this parameter name, get the image and put it in .docx file.

– unreax
Mar 7 at 11:18






Yes, extract image. I have xlsx document with multiple sheets and image in every sheet. Sheet's names are parameter name(for example "A2D_39CCA"). On the other side I have .docx document with all of these parameters in it, and every parameter is on new page. I need to search in .xlsx file for every single parameter, go to the sheet which name is this parameter name, get the image and put it in .docx file.

– unreax
Mar 7 at 11:18














Images are attached to worksheets and not cells.

– Charlie Clark
Mar 7 at 12:05





Images are attached to worksheets and not cells.

– Charlie Clark
Mar 7 at 12:05













Okay, I've tried also: for image in ws._images: document.add_picture(image.path) But gives me: IOError: [Errno 2] No such file or directory: '/xl/media/image1.png'

– unreax
Mar 7 at 12:09






Okay, I've tried also: for image in ws._images: document.add_picture(image.path) But gives me: IOError: [Errno 2] No such file or directory: '/xl/media/image1.png'

– unreax
Mar 7 at 12:09





2




2





The path on an image is the virtual path inside the zip, so you cannot use that. There is a _data method on image which is supposed to give you back png bytes, maybe you can write them to a file and then construct a new image to import into the Document (or view the .png file)

– eckes
Mar 7 at 12:31





The path on an image is the virtual path inside the zip, so you cannot use that. There is a _data method on image which is supposed to give you back png bytes, maybe you can write them to a file and then construct a new image to import into the Document (or view the .png file)

– eckes
Mar 7 at 12:31












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55041195%2fhow-to-get-image-from-xlsx-file%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55041195%2fhow-to-get-image-from-xlsx-file%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved