How to construct Dataframe from a Excel (xls,xlsx) file in Scala Spark?

后端 未结 5 1520
自闭症患者
自闭症患者 2020-11-28 08:13

I have a large Excel(xlsx and xls) file with multiple sheet and I need convert it to RDD or Dataframe so that it can be joined to othe

5条回答
  •  独厮守ぢ
    2020-11-28 09:07

    Hope this should help.

    val df_excel= spark.read.
                       format("com.crealytics.spark.excel").
                       option("useHeader", "true").
                       option("treatEmptyValuesAsNulls", "false").
                       option("inferSchema", "false"). 
                       option("addColorColumns", "false").load(file_path)
    
    display(df_excel)
    

提交回复
热议问题