21番茄网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 21番茄网
查看: 1851|回复: 0

python 获取excel文件的所有sheet(工作表)名称

[复制链接]

720

主题

940

帖子

3116

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3116
发表于 2021-11-1 15:15:17 | 显示全部楼层 |阅读模式
1. 使用pandas

import pandas
file_path = '1.xlsx'
xls = pandas.ExcelFile(file_path)
sheet_names = xls.sheet_names


2. 使用openpyxl

import openpyxl
file_path = '1.xlsx'
xls = openpyxl.load_workbook(file_path)
sheet_names = xls.sheetnames


来自:https://blog.csdn.net/hj009zzh/article/details/112316560




上一篇:openpyxl自动删除excel中指定行的数据的方法
下一篇:用xlrd 模块操作excel中
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|21番茄网 ( 粤ICP备10099428号 ) 奇远富

GMT+8, 2025-2-22 16:47 , Processed in 0.162842 second(s), 31 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表