openpyxl - Excel in Python: Quick Start

"openpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files"

https://openpyxl.readthedocs.io/en/stable/

install

$ pip install openpyxl

hello world (new file)

from openpyxl import Workbook


workbook = Workbook()

sheet = workbook.active


sheet['A1'] = 'hello world'

workbook.save(filename='test.xlsx')



hello world (update)

from openpyxl import Workbook

import openpyxl


# workbook = Workbook()

workbook = openpyxl.load_workbook('test.xlsx')

sheet = workbook.active


sheet['A1'] = 'hello world'

workbook.save(filename='test.xlsx')


Comments

Popular posts from this blog

Minikube Installation for M1 Mac

Selenide: Quick Start

PyCharm: Quick Start