Forum Discussion
One Lake
Hi Lachu1935,
Thank you for reaching out to Microsoft Fabric Community.
Thank you Cookistador, chris_andrews and deborshi_nag for the prompt response.
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.
Thanks and regards,
Anjan Kumar Chippa
6 Replies
- chris_andrewsAdvocate I
Hi Lachu1935 ,
The issue here is that Fabric will not reliably auto-detect ambiguous date types (non ISO dates). As you are importing as a csv it will struggle to identify your dates as dates, read them as a string and format as text.
The solution here is to do one of the following:
- Structure your dates in your source data to a common ISO format like 2026-01-30 (yyyy‑mm‑dd)
- Change the column format using a notebook as Cookistador suggests (but this seems to be not working)
- Bring your data in using Dataflow Gen2 and using the Power Query editor to change the column format
I would personally get into the habit of using ISO date formats in data reporting if possible. You will have far less trouble when ingesting and transforming data.
EDIT:
Have you tried Data Wrangler in notebooks? This assists you in transforming data within notebooks.
df = spark.read.option("header", "true").csv("Files/myfolder/myfile.csv")
display(df)
Accelerate Data Prep with Data Wrangler - Microsoft Fabric | Microsoft Learn
- deborshi_nagSuper User
Hello Lachu1935
It is best to drop the CSV file in /Files (consider it a Landing zone), read the content using PySpark explicitly specifying the schema, and finally write to /Tables area in your "bronze" schema. I attach a code snippet.
from pyspark.sql.types import StructType, StructField, StringType, IntegerType, DoubleType, DateType schema = StructType([ StructField("order_id", StringType(), True), StructField("customer_id", StringType(), True), StructField("order_date", DateType(), True), # <-- DateType; parsed using dateFormat StructField("channel", StringType(), True), StructField("quantity", IntegerType(),True), StructField("unit_price", DoubleType(), True) ]) src_path = "/lakehouse/default/Files/ingest/orders/" df = ( spark.read .format("csv") .option("header", "true") # CSV has headers .option("mode", "PERMISSIVE") # don't fail job on a few bad lines .option("dateFormat", "dd-MM-yyyy")# <-- critical: tell Spark how to parse DateType .schema(schema) .load(src_path) ) spark.sql("CREATE DATABASE IF NOT EXISTS bronze") (df.write .format("delta") .mode("append") # or "overwrite" for full refresh # .partitionBy("order_date") # uncomment if partitioning is helpful for your volume .saveAsTable("bronze.orders") ) - CookistadorSuper User
Hi Lachu1935
it is probably related to the format of your date
It is waiting date in us format so this is why it is recognized as text (in which area is deployed your fabric capacity?)
Instead of doing a auto load from file to table, you can create a small notebook to convert the column in the right format:
df = spark.read.format("csv").option("header", "true").load("Files/yourfile.csv")df = df.withColumn("CREATED_DATE", F.to_date("CREATED_DATE", "dd-MM-yyyy"))df.write.format("delta").mode("overwrite").saveAsTable("mra_dec_2025")
- Lachu1935Regular Visitor
Thank you Team for such a meaningful guidance from you all , the issue was now resloved thanlks for the support Thank you
- Lachu1935Regular Visitor
I have tried this, but the column still changes to all null values. Could this be an issue with the CSV file? I have checked, and the column shows as a data format.
- v-achippaCommunity Support
Hi Lachu1935,
Thank you for reaching out to Microsoft Fabric Community.
Thank you Cookistador, chris_andrews and deborshi_nag for the prompt response.
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.
Thanks and regards,
Anjan Kumar Chippa