python - Reading and writing large files in openpyxl -
i trying copy cells large excel file large excel file, both files .xlsx. using openpyxl module. below code:
>>> import openpyxl >>> wb1=openpyxl.load_workbook('file1.xlsx',read_only=true) error:
traceback (most recent call last): file "c:\users\u6038633\appdata\local\programs\python\python36-32\lib\site-packages\openpyxl\reader\excel.py", line 118, in _validate_archive archive = zipfile(filename, 'r', zip_deflated) file "c:\users\u6038633\appdata\local\programs\python\python36-32\lib\zipfile.py", line 1108, in __init__ self._realgetcontents() file "c:\users\u6038633\appdata\local\programs\python\python36-32\lib\zipfile.py", line 1175, in _realgetcontents raise badzipfile("file not zip file") zipfile.badzipfile: file not zip file during handling of above exception, exception occurred:
traceback (most recent call last): file "<pyshell#5>", line 1, in <module> wb2=openpyxl.load_workbook('consolidated gl line item report_ytd.xlsx',read_only=true) file "c:\users\u6038633\appdata\local\programs\python\python36-32\lib\site-packages\openpyxl\reader\excel.py", line 171, in load_workbook archive = _validate_archive(filename) file "c:\users\u6038633\appdata\local\programs\python\python36-32\lib\site-packages\openpyxl\reader\excel.py", line 121, in _validate_archive archive = zipfile(f, 'r', zip_deflated) file "c:\users\u6038633\appdata\local\programs\python\python36-32\lib\zipfile.py", line 1108, in __init__ self._realgetcontents() file "c:\users\u6038633\appdata\local\programs\python\python36-32\lib\zipfile.py", line 1175, in _realgetcontents raise badzipfile("file not zip file") zipfile.badzipfile: file not zip file while opening in write mode, used code:
wb2=openpyxl.load_workbook('file2.xlsx',write_only=true) error:
traceback (most recent call last): file "<pyshell#6>", line 1, in <module> wb2=openpyxl.load_workbook('consolidated gl line item report_ytd.xlsx',write_only=true) typeerror: load_workbook() got unexpected keyword argument 'write_only'
there no parameter write_only=true
load_workbook(filename, read_only=false, keep_vba=false, data_only=false, guess_types=false, keep_links=true)
use:
wb2 = openpyxl.load_workbook('file2.xlsx')
Comments
Post a Comment