[Dale Strickland-Clark] | from win32com.client import GetObject, constants | | def GetExcelData(self, strFilePath): | """ Extract the data from the Excel sheet. | Returns tuple of tuples representing the rows and cells.""" | # The following line extracts | # all the data from sheet 1 of the spreadsheet | return GetObject(strFilePath).Sheets(1).UsedRange.Value
Amazing! I never knew you could do that -- GetObject against a registered file path, I mean. Certainly beats my trying to remember whether you call .Open on an Excel Application, Workbook, Worksheet or something else altogether. Thanks, Dale. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ -- http://mail.python.org/mailman/listinfo/python-list