export pictures from Excel xls or xlsx

Hi all,

I have a excel file with pictures of curves in it. Now I like to export these curves in Knime from the Excel file to a directory. I could not find a way on the internet.
With a VB script this is possible, but like to do this in Knime, because I also use Knime for the rest of the data handling.
This is an Excelfile with the pictures. It is not about the colored dots in column D,E or F, but the graphs in column N.

Knime DRC example Export AB.xlsx (80.6 KB)

Thanks,

Ron

I had a little try…but I guess it is not possiblke this way…
Instead I recommend to create the charts directly in Knime

Hi adaptagis,

the data and the graphs are already created in another software package and from there exported in the xls format. There is no other export choice in this software package.

But thanks

If you are working on a windows machine there could be a way via Python. Could be some work but it could be possible to integrate that in a Python Snippet or a Jupyter notebook.

Hi mlauber,
thanks for your suggestion, but I am not familiar with Python at all. And don’t know how to use this script or how to implement this in the Python snippet

so the charts are stored somewhere as images or can be exportet directly to Knime rather than via Excel… that would be an easier task I assume…
check in NodePit for Image Reader Node, and image to table…
good luck!

1 Like

Hello @RonG -

I noticed that @gab1one has a nice workflow here that almost works for your use case:

The problem is that the library underlying the Image Reader (Table) node doesn’t support Windows EMF files, which is the format your images are in. Now if you all you care about is moving the image files around on your file system without reading them into KNIME, this might be OK - you would just need to update the workflow to copy the EMF images into another (non-temporary) directory on your system. Otherwise, if you need to bring the images into KNIME itself… maybe Gabriel has another suggestion?

Hi ScottF,

thanks for this response. This would solve the problem if it is possible in Knime to save the xls file as a htm file.Then the dir will be created with all the png files.
Otherwise I still need Excel to open the xls file and save it as a htm file. In that case I also can directly export the pictures from Excel.

If I use option2 then the pictures are saved in the EMF format. But need them in the PNG format. Is there a way in KNIME to reformat EMF fles to a PNG format?

I like to do the whole workflow in KNIME instead of Excel

Thanks a lot sofar

Ron

You can try to save file using BIRT reporter.

I looked into this a little more. As best I can tell, there isn’t a way to have KNIME duplicate Excel’s functionality when saving an XLSX file as an HTM file. So option 1 is out.

Using option 2, I needed a way to convert EMF to PNG. But the usual nodes we would use to do this in KNIME don’t support EMF. So, I came up with a very hacky workaround. It’s uglier than I would like, but it seems to work.

I downloaded the free, open-source tool ImageMagick for Windows - other OS options are available - since I wanted something that would batch convert images from the command line. I then updated @gab1one 's previous workflow to use the External Tool node, which calls ImageMagick within a loop to convert the files. I had to wrap this node inside some Try/Catch logic, which you can see inside the metanode.

Extract Images from Excel File_External PNG ImageMagick Conversion.knwf (42.9 KB)

If you are willing to install one small additional program, this should work for you. You might have to make some minor adjustments within the External Tool node to the input, output, and executable file paths.

Cheers!

3 Likes

I will try this option and let you know if I succeed in exporting the DRC graphs

Thanks

Hi ScottF,

I am still not able to test your proposed workflow because i still don’t have permission to install the
open-source tool [ImageMagick for Windows ]
But when I’am able to install it, I will test your workflow

Cheers

1 Like