cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error truncating #REF with spark.read

arthurandraderj
New Contributor

Hello guys

I am trying to read an excel file and even using PERMISSIVE mode, its truncating the records that contains #REF in any column 😥

Can anyone please help me on that?

 

schema = StructType([\
        StructField('Col1', DateType(), True), \ <----------THIS COLUMN HAS #REF
        StructField('Col2', DateType(), True), \
        StructField('Col3', StringType(), True)])

test = (
                            spark.read.format("com.crealytics.spark.excel")
                            .option("header", header_option)
                            .option("parseMode", "PERMISSIVE")
                            .option("keepUndefinedRows", True)
                            .option("useNullForErrorCells", True)
                            .option("treatEmptyValuesAsNulls", True)
                            .option("setErrorCellsToFallbackValues", "true")
                            .option("maxRowsInMemory", 1000)
                            .option("useNullForErrorCells", True)
                            .option("dataAddress", "Test!A1:C200")
                            .schema(schema)
                            .load("File.xlsx")

 

0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group