Notice
Recent Posts
Recent Comments
Link
JY Tech
[파이썬]xlrd.biffh.XLRDError(xlrd오류) 본문
엑셀에 있는 링크를 타고 들어가 이미지를 다운받으려고 아래와 같은 코드를 작성했다
import os
import pandas as pd
import requests
excel_file_path = '파일명.xlsx'
df = pd.read_excel(excel_file_path)
download_folder = '목록'
os.makedirs(download_folder, exist_ok=True)
중략...
print('다운로드 및 저장 완료')
그런데
Missing optional dependency 'xlrd'. Install xlrd
이런 오류가 떴다.
파이썬을 하다가 install~~가 나오면 대부분은 pip를 통해 설치하면 해결된다.
pip사용법은 간단하다.
1. cmd에 들어가서
2. 'pip install 설치하고 싶은 라이브러리'를 입력하면 된다
즉 이번 경우에는 cmd에 들어가서
pip install xlrd
를 입력하면 된다.
그런데 또다시
xlrd.biffh.XLRDError: Excel xlsx file; not supported
이런 오류가 떴다.
이 오류의 원인은 xlrd에서 xlsx의 형식을 지원하지 않아서 그렇다고 한다.
df = pd.read_excel(excel_file_path)
라고 쓰인 부분을
df = pd.read_excel(excel_file_path, engine='openpyxl')
이렇게 engine='openpyxl'을 추가하여 수정하면 된다.
참고로 'xlsxwriter'를 사용하는 것도 방법이 될 수 있다고 한다.
코딩 관련 포스팅도 조만간 몇가지 더 올릴 예정이다..
'Programming > Error Solution' 카테고리의 다른 글
[안드로이드]findViewById오류 (0) | 2023.12.09 |
---|---|
[파이썬] raise KeyError(key) from err (1) | 2023.11.27 |
[C#/윈폼]"도구상자 항목 '###'을(를) 로드하지 못했습니다. 해당 항목은 도구상자에서 제거됩니다. (0) | 2023.04.30 |
[파이썬,sqlite] incorrect number of bindings supplied. the current statement uses 1 and there are 3 supplied (0) | 2023.04.21 |
파이썬 TypeError: can only concatenate str (not "list") to str (0) | 2023.04.04 |