importsysimportadodbapitry:importadodbapi.is64bitasis64bitis64=is64bit.Python()exceptImportError:is64=Falseifis64:driver="Microsoft.ACE.OLEDB.12.0"else:driver="Microsoft.Jet.OLEDB.4.0"extended='Extended Properties="Excel 8.0;HDR=Yes;IMEX=1;"'try:# first command line argument will be xls file name -- default to the one written by xls_write.pyfilename=sys.argv[1]exceptIndexError:filename='xx.xls'constr="Provider=%s;Data Source=%s;%s"%(driver,filename,extended)conn=adodbapi.connect(constr)try:# second command line argument will be worksheet name -- default to first worksheetsheet=sys.argv[2]exceptIndexError:# use ADO feature to get the name of the first worksheetsheet=conn.get_table_names()[0]print(('Shreadsheet=%s Worksheet=%s'%(filename,sheet)))print('------------------------------------------------------------')crsr=conn.cursor()sql="SELECT * from [%s]"%sheetcrsr.execute(sql)forrowincrsr.fetchmany(10):print((repr(row)))crsr.close()conn.close()