Solved! Go to Solution.
import win32com.client xl = win32com.client.Dispatch('Excel.Application') xl.Visible = 1 wb = xl.Workbooks.Add() datasheet = wb.Worksheets.Add() datasheet.Name = 'New name for my worksheet' datasheet.Cells(1, 1).Value = 'This is cell A1' datasheet.Cells(2, 2).Value = 'This is cell B2' wb.SaveAs('C:\\Temp\\example.xlsx') wb.Close(SaveChanges=1) xl.Quit() del xl
from xlrd import open_workbook,XL_CELL_TEXT book = open_workbook('simple.xlsx') sheet = book.sheet_by_index(1) cell = sheet.cell(0,0) print cell print cell.value print cell.ctype==XL_CELL_TEXT for i in range(sheet.ncols): print sheet.cell_type(1,i),sheet.cell_value(1,i)
from mmap import mmap,ACCESS_READ from xlrd import open_workbook print open_workbook('simple.xls') with open('simple.xls','rb') as f: print open_workbook( file_contents=mmap(f.fileno(),0,access=ACCESS_READ) ) aString = open('simple.xls','rb').read() print open_workbook(file_contents=aString)
Double check your xlrd version and test on a simple xlsx file.
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-0.9.7.tar.gz Extracting in c:\users\paul\appdata\local\temp\tmptm3fqf Now working in c:\users\paul\appdata\local\temp\tmptm3fqf\setuptools-0.9.7 Installing Setuptools Something went wrong during the installation. See the error message above. Traceback (most recent call last): File "C:\Users\Paul\Documents\pyscripts\ez_setup.py", line 264, in <module> sys.exit(main()) SystemExit: 2