Lecture 파이썬에서 엑셀 사용하기

Lecture • Views 71 • Comments 0 • Created at 1 month ago • Last Updated at 1 month ago  
  • 엑셀
  • 엑셀

설치

아나콘다가 설치되어 있으면

conda install anaconda::openpyxl

확인

from openpyxl import Workbook  # Workbook 라이브러리를 연다 
wb = Workbook( ) # Workbook 객체를 만든다. 
ws = wb.active 
ws.title = '처음 만든 시트' 
ws['A1'] = '이름'
wb.save('test_excel.xlsx')

workbook으로 만든 객체는 엑셀 파일이다.

from openpyxl import Workbook  # Workbook 라이브러리를 연다 
wb = Workbook( ) # Workbook 객체를 만든다. 
ws = wb.active 
ws.title = '프로그래밍'
r1 = ['학번', '이름']
ws.append(r1)
r2 = [20251234, '이순신']
ws.append(r2)
wb.create_sheet('제어공학')
wb.create_sheet('전기기기')
wb.save('test_excel_02.xlsx')
previous article
last article
Comments
Feel free to ask a question, answer or comment, etc.