2017-01-10 8 views
-1

私は次のコードを試しています。openpyxlのzipfolderからExcelファイルを開く

from zipfile import ZipFile 
from openpyxl import load_workbook 
from io import BytesIO 

zip_path = r"path/to/zipfile.zip" 
with ZipFile(zip_path) as myzip: 
    with myzip.open(myzip.namelist()[0]) as myfile: 
     wb = load_workbook(filename=BytesIO(myfile.read())) 
     data_sheet = wb.worksheets[1] 
     for row in data_sheet.iter_rows(min_row=3, min_col=3): 
      print(row[0].value) 

ことが可能です。この

ValueError: stat: path too long for Windows

を示して?

私は、コードが正常に動作し、次のxlrdでUsing openpyxl to read file from memory

+0

あなたのコードでは、openpyxlではなくxlrdが使用されています。 –

+0

私はものを混ぜました。私は再試行させてください。 – Rahul

+0

私は間違いを訂正しました。それはまだ可能ですか? – Rahul

答えて

0

からロジックをしようとしています。

with ZipFile(zip_path) as myzip: 
     with myzip.open(myzip.namelist()[0]) as myfile: 
      book = xlrd.open_workbook(file_contents=(myfile.read())) 
    sh = book.sheet_by_index(0) 
    #your code here 
関連する問題