简体   繁体   English

使用Python搜寻XLS中的所有工作表

[英]Crawl through all sheets in an XLS with Python

I have a large volume of XLS files. 我有大量的XLS文件。 Within a sheet in the files, it contains a column header of "name" and "number". 在文件的工作表中,它包含“名称”和“数字”的列标题。 Unfortunately the format of each XLS varies and the name of the sheet that the data is in varies from one file to another. 不幸的是,每个XLS的格式各不相同,数据所在的工作表的名称从一个文件到另一个文件也有所不同。

I am able to parse through a sheet using Python 2.7x to extract the data from specific columns what I'm now looking to do is open each XLS file and work out which sheet contains the headers "name" and "number" before then extracting the data within these columns and importing to a MySql. 我能够使用Python 2.7x解析工作表以从特定列中提取数据,现在我要做的是打开每个XLS文件并弄清楚哪个工作表包含标题“ name”和“ number”,然后再提取这些列中的数据并导入到MySql中。

Any suggestions of how to do this or libraries to use? 关于如何执行此操作或使用库的任何建议?

XYPath可能值得一看-它使您可以查询XLS文件中的表内容,包括按列名和列内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM