반응형
openpyxl does not support the old .xls file format, please use xlrd to read this file, or convert it to the more recent .xlsx file format.
openpyxl 라이브러리를 사용하면 엑셀 특정값 가져오기 쉽다. 하지만 xls 확장자는 지원하지 않았다.
그래서 찾은 방법은 xlrd 라이브러리를 사용하는 것이다.
import xlrd
book = xlrd.open_workbook("myfile.xls")
print("The number of worksheets is {0}".format(book.nsheets))
print("Worksheet name(s): {0}".format(book.sheet_names()))
sh = book.sheet_by_index(0)
print("{0} {1} {2}".format(sh.name, sh.nrows, sh.ncols))
print("Cell D30 is {0}".format(sh.cell_value(rowx=29, colx=3)))
for rx in range(sh.nrows):
print(sh.row(rx))
https://pythonrepo.com/repo/python-excel-xlrd
Please use openpyxl where you can... | PythonRepo
python-excel/xlrd, xlrd xlrd is a library for reading data and formatting information from Excel files in the historical .xls format. Warning This library will no longer
pythonrepo.com
반응형
'프로그래밍 > python' 카테고리의 다른 글
파이썬 pyinstaller 콘솔창 제거 (0) | 2022.02.03 |
---|---|
파이썬 셀레니움 팝업창 닫기 python selenium close popups (0) | 2022.01.25 |
파이썬 특정폴더내의 특정이름이 포함된 파일만 가져오기 (glob 이용) (0) | 2022.01.25 |
Python Pandas Dataframe index 열 안가져오기 (0) | 2021.11.27 |
Python Pandas Dataframe 원하는(specific, certains) 로우(row)와 컬럼(columns)만 가져오기 (0) | 2021.11.27 |