1

I have some values in my *.xls file but when I try to import them with wb_sheet.col_values(...) I only get empty values. I tried wb_sheet.col(...) and it also claims that those cells are empty. However, they are not, I can see the values in Excel.

My *.xls file was generated by a Labview script and I am pretty sure it contains some makros and stuff. However, xlrd does not return an error.

I would upload a sample sheet but it contains confidential information.

Versions: python 2.7.3, Windows 7, Excel 2010, xlrd 0.8.0.

Small script:

wb = open_workbook('*.xls')
wbs = wb.sheet_by_index(0)
wbs.col(0)

The result I get is empty:'', for all of the cells, even though the first column contains values, when I open with excel.

Community
  • 1
  • 1
user2145054
  • 215
  • 2
  • 3
  • 8
  • Please edit your question so that it contains: which version of Python, which version of what operating system, which version of Excel, which version of xlrd, small script that shows exactly what you are doing and what "it claims that those cells are empty" means, which column you are looking at in Excel, whether the problem goes away if you open the file with Excel then "Save As" file2.xls and use xlrd on file2.xls. – John Machin Mar 07 '13 at 19:43
  • Sure, If you think that helps anything. – user2145054 Mar 08 '13 at 13:11

1 Answers1

0

Expectation: xlrd reports what is in the file. If your missing data values are inserted when "makros and stuff" are executed by Excel when you open the file, then you need to look somewhere else -- see this previous question.

Community
  • 1
  • 1
John Machin
  • 81,303
  • 11
  • 141
  • 189
  • Thanks. As usual with Excel, the macros are deactivated at start (I get a safety warning), so when opening the script, no makros are allowed to be executed. However, xlrd can detect some cell content. Seems like the excel file was created by using a template macro and a macro filling in the values from a measurement. xlrd returns the data from the template macro but not the measurement values. Funnily if I change the cells containing template data and resave it again I still get the original template data in xlrd. – user2145054 Mar 08 '13 at 13:07