我正在尝试读取excel sheet(xlsx),它使用背景颜色来区分值。
我尝试了下面的库:
导入formatting_info=True) xlrd.open_workbook("filename.xlsx",xlrd
它给出的错误是: NotImplementedError: formatting_info=True尚未实现。
从StyleFrame导入StyleFrame中,utils sf = StyleFrame.read_excel('filename.xlsx',read_style=True,from
它给出的错误如下:
Traceback (most recent call last):
File "proj_path/read_excel.py", line 22, in <module>
sf = StyleFrame.read_excel('filename.xlsx', read_style=True, use_openpyxl_styles=False)
File "C:\Anaconda\lib\site-packages\StyleFrame\deprecations.py", line 22, in inner
return func(*args, **kwargs)
File "C:\Anaconda\lib\site-packages\StyleFrame\style_frame.py", line 220, in read_excel
_read_style()
File "C:\Anaconda\lib\site-packages\StyleFrame\style_frame.py", line 209, in _read_style
read_comments and current_cell.comment)
File "C:\Anaconda\lib\site-packages\StyleFrame\styler.py", line 127, in from_openpyxl_style
font_color = theme_colors[openpyxl_style.font.color.theme]
TypeError: list indices must be integers or slices, not Integer
任何帮助我朝着正确方向前进的建议都是非常感谢的。
发布于 2018-09-06 02:52:55
即使可以通过Python,最简单的方法应该是在Excel中按颜色过滤,复制该表并将其粘贴到其他地方,然后导入它,就像使用Pandas导入任何Excel文件一样。
正如DeepSpace评论的那样,它以前也是通过Python完成的,但它相当麻烦
https://stackoverflow.com/questions/52191644
复制相似问题