- http://openpyxl.readthedocs.org/en/default/#
- Excel 2010 이후의 xlsx, xlsm 파일에 대해서 적용 가능
.
.
def save_letter_n_best_reply_to_excel(filename_img, origin_letter, letter, best_reply, filepath):
"""
........
:param filename_img: ...
:param origin_letter: ...
:param letter: ...
:param best_reply: ...
:param filepath: ...
:return:
"""
dir, filename_excel = os.path.split(filepath)
file_list = os.listdir(dir)
worksheet_title = 'this_is_worksheet_title'
if filename_excel not in file_list:
wb = Workbook()
ws = wb.create_sheet(title=worksheet_title, index=0)
columnA = 'Image File Name'
columnB = 'Original Letter (From DB)'
columnC = 'Letter'
columnD = 'Best Reply'
ws.append([columnA, columnB, columnC, columnD])
else:
wb = load_workbook(filepath)
ws = wb.get_sheet_by_name(worksheet_title)
ws.append([filename_img, origin_letter, letter, best_reply])
wb.save(filepath)
.
.
.
'Python > Study' 카테고리의 다른 글
| Python | Study | pytest 설치 및 사용법 (0) | 2016.01.22 |
|---|---|
| Python | Study | Data Type Conversion (0) | 2016.01.15 |
| Python | Study | lambda function Basic (0) | 2016.01.14 |
| JSON 초간단 사용법 (0) | 2015.12.15 |
| Thread 개념 잡기 (0) | 2015.12.15 |