
Pythonで
・Excelファイルのシートを作成
できます!
前提
外部パッケージ「openpyxl」がインストールされていること。
pipコマンドでインストールする場合、以下でインストールできます。
pip install openpyxl
コード
ここでは例として
・デスクトップ配下のファイル「aiueo.xlsx」に
・シート「NewSheet」を作成
します。

import openpyxl
# Excelファイルパス
excel_file_path = r"C:\Users\lunch\Desktop\aiueo.xlsx"
# 開く
wb = openpyxl.load_workbook(excel_file_path)
# シートを作成する
ws = wb.create_sheet("NewSheet")
# 保存
wb.save(excel_file_path)
# 閉じる
wb.close()
print("正常終了しました。")
実行結果
シートを作成できました。
※シート「NewSheet」を作成できました。


参考
外部パッケージ「openpyxl」の詳細は、公式サイトをご確認ください。