From the course: Using Python with Excel
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Using openpyxl with Workbooks
From the course: Using Python with Excel
Using openpyxl with Workbooks
Several packages exist for working with Python and Excel together, but openpyxl is a great all-around choice because of its rich features for both reading from and writing to workbooks. Ready to see for yourself? Time to jump into Jupyter and get started with an introduction to openpyxl. Open the demo file for this lesson, 02_01_demo. You should also have a workbook called regions.xlsx available in the exercise files. First, I'll import the relevant openpyxl modules for this lesson, workbook.workbook which will be used to create workbooks and load_workbook, which you guessed it, will load them. I'm going to create an Excel workbook from scratch via openpyxl, which again can be done with the workbook function. And I'll name this object wb so I can easily refer to it later. Now, creating a workbook directly from Python is pretty cool, but that workbook is pretty useless without a worksheet to put data into. So my next step is to create a worksheet object ws = wb.active or the active…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.