Excelは業務上の様々なデータを管理するのに欠かせない存在だ。そのため、Pythonを使って操作を自動化できると便利なことが多い。今回は、PythonからExcelファイルを作成する方法を紹介する。日本中で新年号「令和」が話題になっているので、Excelファイル作成の例題として和暦西暦の対応表を作ってみよう。 Excelライブラリの『openpyxl』をインストールしよう ただし、Python自体には、Excelファイルの読み書き機能は搭載されていない。しかし、拡張ライブラリをインストールすることで、読み書きできるようになる。 Windows環境にAnacondaをインストールしているなら、Windowsのスタートメニューより「Anaconda3 > Anaconda Prompt」を起動しよう。macOSなら『標準のターミナル.app』を開いて以下のコマンドを入力して、openpyxl