0
votes

I am trying to read an excel file using Spark CLI, but I am getting "org.apache.poi.openxml4j.exceptions.InvalidFormatException: Your InputStream was neither an OLE2 stream, nor an OOXML stream" error.

Below is the data present in my excel sheet:

Id  Name    City
1   Amit    Panji
2   Sharma  Mumbai
3   Kumar   Pune
4   Abhay   Delhi
5   Rohit   Gurgaon

Below is the code I am using:

    import com.crealytics.spark.excel

    val df = spark.read.format("com.crealytics.spark.excel")
    .option("useHeader", "true")
    .option("startColumn", 0)
    .option("treatEmptyValuesAsNulls", "false")
    .option("inferSchema", "false")
    .option("location", "/home/Desktop/lucky/logs.xlsx")
    .option("addColorColumns", "False")
    .load()
1

1 Answers

0
votes

What Excel's version are you using?

The Apache POI site said:

Apache POI is your Java Excel solution (for Excel 97-2008)

Apache POI site: https://poi.apache.org/