openpyxl - Gakgu/Gakgu.github.io GitHub Wiki
๊ฐ์
ํ์ด์ฌ์์ ์์ ํ์ผ์ ์ ๊ทผ, ์กฐ์์ด ๊ฐ๋ฅํ๊ฒ ๋ง๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ.
๊ณต์ ํํ์ด์ง
https://openpyxl.readthedocs.io
์ฌ์ฉ๋ฒ
์์ ํ์ผ ์์ฑ, ์ด๊ธฐ
excel = openpyxl.Workbook()
excel = openpyxl.load_workbook("./fixs.xlsx")
์ํธ
# ์ํธ ์์ฑํ๊ธฐ
sheet = excel.create_sheet('new sheet')
# ํ์ฑํ๋ ์ํธ ์ป๊ธฐ
sheet = excel.active
# ์ํธ ์ด๋ฆ์ผ๋ก ์ป๊ธฐ
sheet = excel[sheetname]
# ๋ชจ๋ ์ํธ ์ ๊ทผํ๊ธฐ
for sheet in excel:
pass
ํ, ์ด ์ ๊ทผํ๊ธฐ
for row in range(0, 100):
sheet.cell[row, 1]
๊ฐ ์ป๊ธฐ
# cell ๋ฒํธ๋ก ์ป๊ธฐ
value = sheet[row, column].value
์ ์ฅ ๋ฐ ์ข ๋ฃ
excel.save()
excel.close()