Re: Reading/ Writing GNU XML format



Steve Swann wrote:
[snip]
Once I receive the file at the Webserver I intend to read the XML file and upload the spreadsheet contents to a database. I piloted this approach and all seemed to go very well until I discovered that formula are represented in the cell element value as only a formula descriptor . The problem with that is that I cannot easily determine the value of the cell. So for example if Cell(row=10, col=20) = "=C4" and the value of the cell is 200 then all I get for the cell element value is "=C4". Is there anyway a value pair can be provided, the formula and the cell value at the time the spreadsheet was saved.

Alternatively is there an API that I can call from an external Python program that will allow me to easily determine the value of the cell content when it has a formula. I have written a lot of interfaces to Excel where this is possible, but it then requires the server to run Windows and Excel so that I have access to the Excel object model. As I much prefer to run a Linux based server and not all teachers have access to Excel is there a solution to this problem.

If you have an alternate approach to this problem please let me know.

Alternative:
1. Have the teachers save their files as Excel .XLS files.
2. Use xlrd (see http://www.lexicon.net/sjmachin/xlrd.htm)

Example:
A1 contains =1+2
A2 contains ="Hello"&"world"

>>> import xlrd
>>> book = xlrd.open_workbook('madebygnu.xls')
>>> sheet = book.sheet_by_index(0)
>>> sheet.row_values(0)
[3.0, u'Helloworld']
>>>


HTH,
John



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]