简体   繁体   中英

Extracting images from excel sheet by row with python

I am trying to extract images from excel sheet. The excel sheet is basically a list of products with images and details of products.

with

EmbeddedFiles = zipfile.ZipFile(path).namelist()
ImageFiles = [F for F in EmbeddedFiles if F.count('.jpg') or F.count('.jpeg')]

I can extract all images at once but i cannot figure out a way to get images by row so that i could save products into database and add images to respective products.

I was using openpyxl to read from excel but that does not provide a way to get images. I can shift to other libraries.

What would be the best way to do this.

The xlsx file is indeed in compressed format, but that does not mean that you have to expand it to work with it. Let openpyxl do that for you. The library in its documentation mentions that it can handle this format pretty well.

So try opening the file and reading line by line using this , this and this example found in the documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM