예제 실행시 사용하였던 엑셀 파일 데이터 및 시트 정보
▪ 3행 4열 데이터셋
▪ 3개 시트로 구성
Copy import openpyxl from openpyxl import workbook # You must change the physical path before running this script. currPath = "C:/Users/natio/OneDrive - 성균관대학교/99. Personal Blog/05. Python/05. OPENPYXL_XLRD_XLWT/01. Excel Sheet/" # Load the excel file wb = openpyxl.load_workbook(filename=currPath+"Sample Sheet File.xlsx") # Create New Sheet wb.create_sheet(title='New Sheet', index=0) print(wb.sheetnames)
Result
Copy import openpyxl from openpyxl import workbook # You must change the physical path before running this script. currPath = "C:/Users/natio/OneDrive - 성균관대학교/99. Personal Blog/05. Python/05. OPENPYXL_XLRD_XLWT/01. Excel Sheet/" # Load the excel file wb = openpyxl.load_workbook(filename=currPath+"Sample Sheet File.xlsx") # Remove Sheet wb.remove(wb['Sample Sheet']) print(wb.sheetnames)
Openpyxl 함수 모음
※ 이 글이 도움이 되었다면 "🤍공감" 버튼을 클릭해주세요. 클릭 한번이 글 쓰는데 큰 힘이 됩니다.
* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.