Python xlrd处理Excel文件
''' 参考链接: https://www.cnblogs.com/insane-Mr-Li/p/9092619.html ''' import xlrd data = xlrd . open_workbook ( filename ) #文件名以及路径,如果路径或者文件名有中文给前面加一个r拜师原生字符。 table = data . sheets ( ) [ 0 ] #通过索引顺序获取 table = data . sheet_by_index ( sheet_indx ) ) #通过索引顺序获取 table = data . sheet_by_name ( sheet_name ) #通过名称获取 #以上三个函数都会返回一个xlrd.sheet.Sheet()对象 names = data . sheet_names ( ) #返回book中所有工作表的名字 data . sheet_loaded ( sheet_name or indx ) # 检查某个sheet是否导入完毕 #对行的操作 nrows = table . nrows #获取该sheet中的有效行数 table . row ( rowx ) #返回由该行中所有的单元格对象组成的列表 table . row_slice ( rowx ) #返回由该列中所有的单元格对象组成的列表 table . row