如何在 java 中读取和附加 .xlsm 文件

How to read and append a .xlsm file in java

我想读取并附加 java 中的 .xlsm 文件。我不知道该怎么做。 我需要下载任何 jar 文件才能使用它吗? 所有搜索结果都提供了一个使用 apache poi 的解决方案(我没有得到它是什么)。我不使用任何 IDE。使用简单的 FileReader 和其他逻辑我不能处理这种类型的文件吗?

请让我清楚地了解什么是 .xlsm 文件以及如何使用 java 来处理它。

"XLSM is a Microsoft Excel macro-enabled spreadsheet that contains worksheets of cells arranged by rows and columns and embedded macros programmed in the Visual Basic for Applications language. XLSM files are like XLSX files, but with macros enabled. They can be opened with Excel 2007 or later, or by previous versions of Excel with Open XML component support."

您可以使用 Apache poi 读取和写入文件。

看看下面的 SO 帖子

write to xlsm (Excel 2007) using apache poi

Read data from read only xlsm file using Java Apache POI

Apache POI 文档位于 https://poi.apache.org/