I have an Excel 2003 spreadsheet with values and formulas. Using Python 2.7, I need to read all the values from the spreadsheet, and none of the formulas. If a cell has a formula, I need the cached value from the cell. Using xlrd, how can I get the actual values from cells which contain formulas? My current method of retrieving the values in each cell gives me incorrect values for any cell which contains a formula.
Asked
Active
Viewed 246 times
1 Answers
-1
By default, I think that's how it works, right. I mean, you have to go out of your way to get the formulas, and just a simple read will get you the data, or calculated values, right.
Try this.
wb = openpyxl.load_workbook(filename, data_only=True)

ASH
- 20,759
- 19
- 87
- 200
-
1The OP has an Excel 2003 spreadsheet (.xls); openpyxl works on .xlsx files. – John Machin Mar 23 '17 at 22:36