Saturday 4 p.m.–4:50 p.m.

Python and Spreadsheets: 2017 Edition

Kojo Idrissa

Audience level:
Novice

Description

Spreadsheet files are often used to share interesting & important data. But spreadsheet applications aren't always the best tool for processing that data. I'll show you how to use OpenPyXL to work with that data in a way that's better than using .csv files. I'll also discuss common problems faced when working with spreadsheets via code. "State of the art" moves fast here, thus the title.

Abstract

Spreadsheet applications are OFTEN terrible and misused. But spreadsheet FILES are everywhere! As one of the default forms of data exchange, learning to work with spreadsheet files directly via Python can save time and effort. We'll look at Openpyxl, a library that lets you do just that.

We'll start by looking at two basic uses. First we'll read data from a spreadsheet file to use in a Python program. Then we'll write results from a Python program to a spreadsheet.

Next, we'll look at two different (beginner-friendly) example cases: transforming one spreadsheet into another spreadsheet (an application of what we learned in the first step) and converting a spreadsheet into JSON.

I'll also use my experience as a former accountant (aka "Spreadsheet Wrangler") to highlight some of the practical issues around reading from and writing to a spreadsheet file and how you might deal with them. You MAY even learn to make new friends and grow the Python community! True Story!