# 최초 생성 이후 mode는 append; 새로운 시트를 추가합니다.
if not os.path.exists('output.xlsx'):
    with pd.ExcelWriter('output.xlsx', mode='w', engine='openpyxl') as writer:
        df.to_excel(writer, index=False)
else:
    with pd.ExcelWriter('output.xlsx', mode='a', engine='openpyxl') as writer:
        df.to_excel(writer, index=False)

출처 : https://hogni.tistory.com/23

+ Recent posts