Currently I am using com.crealytics.spark.excel to read an Excel file, but using this library I can't write the dataset to an Excel file.
This link says that using hadoop office library (org.zuinnote.spark.office.excel
) we can read and write to Excel files
Please help me to write dataset object to an excel file in spark java.
You can use
org.zuinnote.spark.office.excel
for both reading and writing excel file using Dataset. Examples are given at https://github.com/ZuInnoTe/spark-hadoopoffice-ds/. However, there is one issue if you read the Excel in Dataset and try to write it in another Excel file. Please see the issue and workaround in scala at https://github.com/ZuInnoTe/hadoopoffice/issues/12.I have written a sample program in Java using
org.zuinnote.spark.office.excel
and workaround given at that link. Please see if this helps you.I have tested this code with Java 8 and Spark 2.1.0. I am using maven and added dependency for
org.zuinnote.spark.office.excel
from https://mvnrepository.com/artifact/com.github.zuinnote/spark-hadoopoffice-ds_2.11/1.0.3