
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
엑셀샘플파일 진행시 에러가 납니다
강의하신대로 진행한 것 같은데 아래 확인 좀 부탁드립니다
import openpyxl
wb = openpyxl.load_workbook('샘플파일.xlsx')
sheet = wb['Sheet']
rows = sheet.rows
for row in rows:
print(row[0].value)
에러 내용 아래 추가합니다.
---------------------------------------------------------------------------
BadZipFile Traceback (most recent call last)
<ipython-input-45-de9771dcd5d5> in <cell line: 2>()
1 import openpyxl
----> 2 wb = openpyxl.load_workbook('샘플파일.xlsx')
3 sheet = wb['Sheet']
4
5 rows = sheet.rows
4 frames
/usr/lib/python3.10/zipfile.py in _RealGetContents(self)
1334 raise BadZipFile("File is not a zip file")
1335 if not endrec:
-> 1336 raise BadZipFile("File is not a zip file")
1337 if self.debug > 1:
1338 print(endrec)
BadZipFile: File is not a zip file
작성한 코드 및 에러 메세지
오류 발생 시, 작성한 코드 전체와 에러 메시지를 첨부해 주세요.
import openpyxl
wb = openpyxl.load_workbook('샘플파일.xlsx')
sheet = wb['Sheet']
rows = sheet.rows
for row in rows:
print(row[0].value)
---------------------------------------------------------------------------
BadZipFile Traceback (most recent call last)
<ipython-input-45-de9771dcd5d5> in <cell line: 2>()
1 import openpyxl
----> 2 wb = openpyxl.load_workbook('샘플파일.xlsx')
3 sheet = wb['Sheet']
4
5 rows = sheet.rows
4 frames
/usr/lib/python3.10/zipfile.py in _RealGetContents(self)
1334 raise BadZipFile("File is not a zip file")
1335 if not endrec:
-> 1336 raise BadZipFile("File is not a zip file")
1337 if self.debug > 1:
1338 print(endrec)
BadZipFile: File is not a zip fileTip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요.
Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!
