可以使用Python中的pandas库和os库来获取文件夹里多个excel里第六行第七列的值。具体步骤如下:

  1. 导入pandas和os库
import pandas as pd
import os
  1. 设置文件夹路径和要读取的文件类型
folder_path = 'your_folder_path'
file_type = 'xlsx'
  1. 获取文件夹里所有符合要求的文件路径并循环读取每个文件的第六行第七列的值
for file_name in os.listdir(folder_path):
    if file_name.endswith(file_type):
        file_path = os.path.join(folder_path, file_name)
        df = pd.read_excel(file_path, header=None)
        value = df.iloc[5, 6]  # 第六行第七列的值
        print(file_name, value)

注意:上述代码中的iloc[5, 6]表示获取第六行第七列的值,因为Python中的索引是从0开始的,所以实际对应的是excel表格中的第六行第七列

使用python获取文件夹里多个excel里第六行第七列的值

原文地址: https://www.cveoy.top/t/topic/fRC2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录