试图使用python上的Linux上的Linux上的excel文件中仅获得值,而不是来自Excel文件的公式
我有一个大的Excel文件,有很多张纸,并且公式中的主纸使用其他纸张的值。我需要仅出口或加载的主表,而不是预先计算的值,而不是公式或NAN。我想在Linux上使用Python做到这一点。如果我使用Windows并在其中使用Excel,那将很简单,因为我只需要复制粘贴表即可存储值,并且可以这样编程。但是,当涉及Linux时,它会变得棘手。我已经尝试了许多已知的库,几乎所有图书馆似乎都不计算公式,或者只是给我空的单元格或NAN。如果您成功地做到了,请提供帮助。由于我在这里没有找到许多解决方案,因此我需要创建自己的解决方案。
I have a large excel file that has many sheets, and the main sheet in its formulas uses values from the other sheets. I need the main sheet exported or loaded with just the precalculated values and not the formulas or NaNs. I want to do that using python on Linux. It would be simple If I use windows and have Excel in it since I would just need to copy paste the sheet and it will store only values, and it is programable that way. But when it comes to linux it gets tricky. I already tried many known librarys and almost all seems to either not calculate the formulas or just give me the empty cells or NaNs. If you managed to successfully do it, please help. Since I haven't found solution on many posts here, I needed to create my own.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Python和Excel可以一起工作,但不是为彼此制作的。作为Linux用户自己:为什么不只是使用Windows解决方案,而是使用从libreoffice 而不是excel? CALC可以打开Excel文件并将其保存为Excel Asell。
编辑:
如果您使用 opentypyxl 您可以使用
data_only
flag仅获取数据,而不是公式。喜欢:wb = OpenPyxl.load_workbook(文件名,data_only = true)
我确定这也是其他常见的Excel Python Parsers中的功能。
Python and Excel can work together, but are not made for eachother. As a linux user myself: why don't you just use your Windows solution but with Calc from LibreOffice instead of excel? Calc can open Excel files and save it as Excel aswell.
EDIT:
If you use OpenPyXL you can use the
data_only
flag to get only the data, not the formulas. like in:wb = openpyxl.load_workbook(filename, data_only=True)
I'm sure this is also a feature in other common Excel Python Parsers.