python的sheet的方法

时间:2024-10-14 03:44:44

1、打开pycharm工具,新建python文件,并导入xlrd、xlwt和shutil

python的sheet的方法

2、调用xlrd库中的open_workbook方法,打开user.xlsx文件

python的sheet的方法

3、使用sheets()方法获取所有sheet页,加个序号获取某个sheet页

python的sheet的方法

4、调用row_values(0)获取excel文件sheet中的第一行数据

python的sheet的方法

5、相应的,使用col_values(0)获取excel文件sheet中的第一列数据

python的sheet的方法

6、如果要获取sheet页中的记录的行数和列数,可以使用nrows和ncols

python的sheet的方法

7、如果调用cell()方法,后面点value,获取某个单元格的数据

python的sheet的方法

8、保存代码并运行python文件,查看控制台打印结果

python的sheet的方法
© 手抄报圈