Tag Archives: Excel

Reading Excel Spreadsheets with Python and xlrd

Last month we looked at how to create Microsoft Excel (i.e. *.xls) files using the xlwt package. Today we will be looking at how we can read an *.xls/*.xlsx file using a package called xlrd. The xlrd package can be run on Linux and Mac as well as Windows. This is great when you need to process an Excel file on a Linux server.

We will start out by reading the first Excel file we created in our previous article.

Let’s get started! Continue reading Reading Excel Spreadsheets with Python and xlrd

Python and Microsoft Office – Using PyWin32

Most typical users have used Microsoft Office. While Office may be the bane of tech support, we still have to deal with it. Python can be used to script (AKA automate) Office and make it easier for us or our users to use. It may not be as easy as recording a macro, but it’s close. For this article, you will learn how to use the PyWin32 module to access some of the Office programs and manipulate them with Python. Some forums say that you need to run PythonWin’s makepy utility on Microsoft Word (and Excel) before you can access Office applications. I don’t think I needed to do that to make it work though (at least, not with the 2007 version). However, PythonWin comes with the PyWin32, so if you do run into trouble, you can try it. Continue reading Python and Microsoft Office – Using PyWin32