0

For a current project I need advanced access to Excel via Python. I found the xlwt project on http://www.python-excel.org/ that allows me to create Excel files and store data into the cells. That's fine.

Unfortunately I need also the following features:

  • Import a external graphic file (EPS)
  • Export a whole spreadsheet as EPS

Any one who knows how to fix this? Workaround using OpenOffice is also OK (even better, we all love free software).

Steve Mayne
  • 22,285
  • 4
  • 49
  • 49
grisu48
  • 18
  • 2

1 Answers1

2

I'll tackle your requirements one at a time:

Import an external graphic file in EPS format

xlwt will allow you to import images into your spreadsheet, but only in BMP format. First you will have to rasterise your EPS file into BMP format, then do:

from xlwt import *

w = Workbook() 
ws = w.add_sheet('Image')
ws.insert_bitmap('python.bmp', 2, 2)

w.save('image.xls')

[taken from this example in the source]

Export a whole spreadsheet as EPS

What you are describing requires Excel itself (or OpenOffice / equivalent) - as it is a rendering operation. The python-excel library you are using is for manipulating the Excel file format, not for rendering it.

Steve Mayne
  • 22,285
  • 4
  • 49
  • 49