Hi @Jothia
I believe you need to replicate the display format, implement the formatting logic in Spark after reading.
Use spark excel normally which will give you raw numeric/text values -
df = (spark.read.format("com.crealytics.spark.excel")
.option("header", "true")
.option("inferSchema", "true")
.load("dbfs:/mnt/path/to/your/file.xlsx"))
df.show()
If you want to mimic the Excel format, you can apply it later in Spark -
from pyspark.sql import functions as F
df_formatted = df.withColumn(
"formatted_value",
F.when(F.col("your_col") < 0,
F.concat(F.lit("("), F.format_number(F.col("your_col"), 0), F.lit(")")))
.when(F.col("your_col") == 0, F.lit("-"))
.otherwise(F.format_number(F.col("your_col"), 0))
)
Hope this helps!