Posts

Showing posts with the label python

Working with MS Excel files from Python

The xlwt Module ( https://pypi.python.org/pypi/xlwt ) - a Python package for generating Microsoft Excel™ spreadsheet files. I have found this module very useful for rapid development. The documentation is currently incomplete, but the package contains a comprehensive set of examples, so you'll most likely start using the module in just 5 minutes. xlwt is a library for generating spreadsheet files that are compatible with Excel 97/2000/XP/2003, OpenOffice.org Calc, and Gnumeric. xlwt has full support for Unicode. Excel spreadsheets can be generated on any platform without needing Excel or a COM server. The only requirement is Python 2.3 to 2.7. The installation is easy. Just unzip the .zip file into a suitable directory, chdir to that directory, then do "python setup.py install". Caveats : The only error I've got is UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) when trying to write 'str...

Create Outlook calendar item with Python

I've created this script when I needed to keep track of my street workout performance. I was needed to have a reminder for each day that will tell me how much repetitions I should do today. So this script will create a bunch of Microsoft Outlook appointments in your calendar according to the "table" dictionary. The table is reduced for this example. It is easier to create such table in MS Excel, then convert it to text and paste into your favourite Python IDE. Please note that this code is using PyWin32 library. def addevent(start, subject):     import win32com.client     oOutlook = win32com.client.Dispatch("Outlook.Application")     appointment = oOutlook.CreateItem(1) # 1=outlook appointment item     appointment.Start = start     appointment.Subject = subject     appointment.Duration = 20     appointment.Location = 'Sprortground'     appointment.ReminderSet = True     appo...