简体   繁体   English

使用 Pandas 在 Excel 中读取删除线

[英]Reading strikethroughs in Excel with Pandas

Is there a way for me to read strikethroughs in Pandas without resorting to VBA?有没有办法让我在不使用 VBA 的情况下阅读 Pandas 中的删除线? I have a spreadsheet where a person refuses to use anything else.我有一个电子表格,其中一个人拒绝使用其他任何东西。

This isn't possible in Pandas but would be using xlrd .这在 Pandas 中是不可能的,但会使用xlrd You could first parse for formatting and then turn that into a Pandas dataframe.您可以先解析格式,然后将其转换为 Pandas 数据框。

Sample code to read a file using xlrd .使用xlrd读取文件的示例代码。 Adapted the response to a similar question :改编了对类似问题的回答

import xlrd.open_workbook

workbook = xlrd.open_workbook('tmp.xls', formatting_info=True)
sheet = wb.sheet_by_name("1")
cell = sheet.cell(6, 0)
format = wb.xf_list[cell.xf_index]
print "type(format) is", type(format)
print
print "format.dump():"
format.dump()

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

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