<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: spark excel reading custom cell in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/129388#M48517</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/173624"&gt;@Jothia&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you need to replicate the display format, implement the formatting logic in Spark after reading.&lt;/P&gt;
&lt;P&gt;Use spark excel normally which will give you&amp;nbsp;raw numeric/text values &lt;STRONG data-start="1216" data-end="1243"&gt;-&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;df = (spark.read.format("com.crealytics.spark.excel")
.option("header", "true")
.option("inferSchema", "true")
.load("dbfs:/mnt/path/to/your/file.xlsx"))

df.show()&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to mimic the Excel format, you can apply it later in Spark -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;from pyspark.sql import functions as F

df_formatted = df.withColumn(
"formatted_value",
F.when(F.col("your_col") &amp;lt; 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))
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Sat, 23 Aug 2025 08:37:19 GMT</pubDate>
    <dc:creator>Vidhi_Khaitan</dc:creator>
    <dc:date>2025-08-23T08:37:19Z</dc:date>
    <item>
      <title>spark excel reading custom cell</title>
      <link>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/127565#M48010</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;some one help me to read&amp;nbsp;excel with custom format cells _(* #,##0_);_(* (#,##0);_(* "-"??_);_(@_) from databricks using spark.excel read&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Aug 2025 12:13:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/127565#M48010</guid>
      <dc:creator>Jothia</dc:creator>
      <dc:date>2025-08-06T12:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: spark excel reading custom cell</title>
      <link>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/129388#M48517</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/173624"&gt;@Jothia&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you need to replicate the display format, implement the formatting logic in Spark after reading.&lt;/P&gt;
&lt;P&gt;Use spark excel normally which will give you&amp;nbsp;raw numeric/text values &lt;STRONG data-start="1216" data-end="1243"&gt;-&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;df = (spark.read.format("com.crealytics.spark.excel")
.option("header", "true")
.option("inferSchema", "true")
.load("dbfs:/mnt/path/to/your/file.xlsx"))

df.show()&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to mimic the Excel format, you can apply it later in Spark -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;from pyspark.sql import functions as F

df_formatted = df.withColumn(
"formatted_value",
F.when(F.col("your_col") &amp;lt; 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))
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Sat, 23 Aug 2025 08:37:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/129388#M48517</guid>
      <dc:creator>Vidhi_Khaitan</dc:creator>
      <dc:date>2025-08-23T08:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: spark excel reading custom cell</title>
      <link>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/129436#M48529</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/173624"&gt;@Jothia&lt;/a&gt;&amp;nbsp;I'd be happy to jump in and take a look if the problem isn't resolved with the post from &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/164253"&gt;@Vidhi_Khaitan&lt;/a&gt;&amp;nbsp;. Seems like an interesting problem! &lt;span class="lia-unicode-emoji" title=":ok_hand:"&gt;👌&lt;/span&gt;.&lt;BR /&gt;&lt;BR /&gt;I guess, as&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/164253"&gt;@Vidhi_Khaitan&lt;/a&gt;&amp;nbsp;mentions, we'll need to apply those steps after we've read it in. There may also be alternate options with Python libraries which have richer support for Excel files to read the custom components in.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The .xlsx file is just a .zip file, there will certainly be ways to tear it apart and read the appropriate bits should it need to get to that. There is consideration needed here for risk vs reward and time spent. Does this really need to be automated for reading the data? How often does this occur etc? Or can you just format it once it's read it as per&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/164253"&gt;@Vidhi_Khaitan&lt;/a&gt;'s answer.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;All the best,&lt;BR /&gt;BS&lt;/P&gt;</description>
      <pubDate>Sat, 23 Aug 2025 12:54:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/129436#M48529</guid>
      <dc:creator>BS_THE_ANALYST</dc:creator>
      <dc:date>2025-08-23T12:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: spark excel reading custom cell</title>
      <link>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/129445#M48532</link>
      <description>&lt;P&gt;Anyone managed to read excel files with weird custom number formats in Spark?&lt;/P&gt;</description>
      <pubDate>Sat, 23 Aug 2025 17:31:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/129445#M48532</guid>
      <dc:creator>SebastianRowan</dc:creator>
      <dc:date>2025-08-23T17:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: spark excel reading custom cell</title>
      <link>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/129448#M48533</link>
      <description>&lt;P&gt;I don't think this should be too hard to handle with a python library&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/169692"&gt;@SebastianRowan&lt;/a&gt;.&amp;nbsp;I'm happy to take a look if you could provide an example of where it doesn't work &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;.&lt;BR /&gt;&lt;BR /&gt;All the best,&lt;BR /&gt;BS&lt;/P&gt;</description>
      <pubDate>Sat, 23 Aug 2025 18:21:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/spark-excel-reading-custom-cell/m-p/129448#M48533</guid>
      <dc:creator>BS_THE_ANALYST</dc:creator>
      <dc:date>2025-08-23T18:21:26Z</dc:date>
    </item>
  </channel>
</rss>

