calamine icon indicating copy to clipboard operation
calamine copied to clipboard

Cannot find out how to read image in cells

Open wellitecho opened this issue 4 years ago • 5 comments

Thanks for the hard work you put into this useful crate. I've used it a lot in my work. Recently I had to work with a .xlsx file with image data in cells, but it seems calamine doesn't have a way to extract images from cells. Wonder if it's possible to extract images from cells or if it's planned to add support for this?

Thanks.

wellitecho avatar Sep 06 '21 08:09 wellitecho

Doesn't look like read_value supports imagines and is why you are getting DataType::Empty. Perhaps the proper way to handle this is to make a datatype such as DataType::Blob to store the reference to the file to be read later as needed.

LovingMelody avatar Sep 06 '21 20:09 LovingMelody

I confirm there is no support for images yet.

tafia avatar Sep 21 '21 02:09 tafia

For my specific case, I resort to use Python, openpyxl, openpyxl-image-loader to get images in .xlsx files. But openpyxl-image-loader only works when one image is contained in a cell. If there are multiple images in a cell, it only gets the first image. So I have but to manually unzip the .xlsx file, parse xml files, and get (col, row): [img1, img2, ..] mapping, which, unfortunately, is not without caveat.

wellitecho avatar Dec 08 '21 09:12 wellitecho

To scratch my own itch, I write this small lib to retrieve a map of {sheetname: {(col, row), imgpath} It's not efficient, but it did the work. Still hope this function will be implemented in calamine, though.

wellitecho avatar Mar 28 '22 03:03 wellitecho

Same issue

zjhiphop avatar Jun 26 '23 10:06 zjhiphop