可以使用 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/oq5g 著作权归作者所有。请勿转载和采集!

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