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?
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
|
show 3 more comments
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
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
|
show 3 more comments
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
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
python image get extract openpyxl
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
|
show 3 more comments
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
|
show 3 more comments
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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