<?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: How to validate CSV blank lines (before &amp;amp; after header) in Microsoft Fabric Data Pipelines? in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4895355#M13913</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1447543" data-lia-user-login="PAVAN_111" class="lia-mention lia-mention-user"&gt;PAVAN_111&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1340679" data-lia-user-login="tayloramy" class="lia-mention lia-mention-user"&gt;tayloramy&lt;/a&gt;&amp;nbsp;&amp;amp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="920086" data-lia-user-login="Ugk161610" class="lia-mention lia-mention-user"&gt;Ugk161610&lt;/a&gt;&amp;nbsp;for sharing valuable insights.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for being part of the Microsoft Fabric Community.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Dec 2025 04:14:22 GMT</pubDate>
    <dc:creator>v-ssriganesh</dc:creator>
    <dc:date>2025-12-08T04:14:22Z</dc:date>
    <item>
      <title>How to validate CSV blank lines (before &amp; after header) in Microsoft Fabric Data Pipelines?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4890591#M13810</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a requirement in Microsoft Fabric to validate CSV files (comma/pipe delimited) stored in a Lakehouse.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We need to detect blank lines in two scenarios:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Blank lines before the header&lt;BR /&gt;The first non-blank line should be considered the header. If any blank lines exist above the header, the file should be marked invalid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Blank lines after the header&lt;BR /&gt;Any blank rows in the data section should also make the file invalid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Additional constraints:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution must be implemented within Fabric only (no Azure Data Factory).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How to achieve in Fabric Data Pipeline (without dataflow Gen2) .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Files should remain in the same folder . we only need an output response/log showing which files are valid or invalid.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;your guidance means a lot and keeps learners like me motivated.&lt;BR /&gt;&lt;BR /&gt;Thanks you&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Dec 2025 11:06:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4890591#M13810</guid>
      <dc:creator>PAVAN_111</dc:creator>
      <dc:date>2025-12-02T11:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate CSV blank lines (before &amp; after header) in Microsoft Fabric Data Pipelines?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4890636#M13812</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1447543" data-lia-user-login="PAVAN_111" class="lia-mention lia-mention-user"&gt;PAVAN_111&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a good “quality gate” use case, and you can do it fully inside Fabric with a pipeline plus a notebook, without Dataflow Gen2 or ADF, and without touching the original files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The simplest pattern is: let the &lt;STRONG&gt;pipeline&lt;/STRONG&gt; call a &lt;STRONG&gt;notebook&lt;/STRONG&gt; that reads each CSV as plain text, checks the lines, and then writes a small log table saying “valid / invalid / reason” for each file. The files stay exactly where they are.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inside the notebook you don’t use spark.read.csv for the check, because that will happily ignore blank lines. Instead, you read the file as text and apply your two rules manually. For example (PySpark in a Fabric notebook):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;from datetime import datetime&lt;/P&gt;&lt;P&gt;folder = "/lakehouse/default/Files/your-folder" # or path passed in from pipeline&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# List all CSV files under the folder&lt;BR /&gt;files_df = spark.read.format("binaryFile").load(folder + "/*.csv").select("path")&lt;BR /&gt;file_paths = [r.path for r in files_df.collect()]&lt;/P&gt;&lt;P&gt;results = []&lt;/P&gt;&lt;P&gt;for path in file_paths:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;# Read file as text, line by line&lt;BR /&gt;lines = spark.read.text(path).rdd.map(lambda r: r.value).collect()&lt;BR /&gt;&lt;BR /&gt;# Strip whitespace&lt;BR /&gt;stripped = [ (i, (line or "").strip()) for i, line in enumerate(lines) ]&lt;/P&gt;&lt;P&gt;# Find first non-blank line = header&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;header_idx = next((i for i, v in stripped if v != ""), None)&lt;BR /&gt;if header_idx is None:&lt;BR /&gt;results.append((path, False, "File is empty or only blank lines"))&lt;BR /&gt;continue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Check for blank lines above header&lt;BR /&gt;if any(v == "" for i, v in stripped[:header_idx]):&lt;BR /&gt;results.append((path, False, "Blank line(s) before header"))&lt;BR /&gt;continue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Check for blank lines after header&lt;BR /&gt;if any(v == "" for i, v in stripped[header_idx+1:]):&lt;BR /&gt;results.append((path, False, "Blank line(s) after header"))&lt;BR /&gt;else:&lt;BR /&gt;results.append((path, True, "Valid"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Write results into a small Delta table in the same Lakehouse&lt;BR /&gt;log_df = spark.createDataFrame(&lt;BR /&gt;[(p, ok, reason, datetime.utcnow()) for p, ok, reason in results],&lt;BR /&gt;["file_path", "is_valid", "reason", "checked_utc"]&lt;BR /&gt;)&lt;BR /&gt;log_df.write.mode("append").saveAsTable("csv_validation_log")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your pipeline just has a notebook activity that passes the folder path (and maybe delimiter info) to this notebook. After it runs, you can query the csv_validation_log table to see exactly which files are valid or invalid and why, without moving or modifying the source files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This stays 100% inside Fabric, uses only a pipeline and a notebook, and gives you a clear yes/no plus reason for every CSV in the folder.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;– Gopi Krishna&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Dec 2025 11:42:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4890636#M13812</guid>
      <dc:creator>Ugk161610</dc:creator>
      <dc:date>2025-12-02T11:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate CSV blank lines (before &amp; after header) in Microsoft Fabric Data Pipelines?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4890678#M13815</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for the suggestion!&lt;BR /&gt;Using a notebook is definitely a possible option, but in my case the requirement is a bit stricter:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I need to implement the solution without Dataflow Gen2 &lt;EM&gt;and&lt;/EM&gt; without using a Notebook.&lt;/STRONG&gt;&lt;BR /&gt;The design should use &lt;STRONG&gt;Fabric Data Pipeline activities only&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Dec 2025 12:19:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4890678#M13815</guid>
      <dc:creator>PAVAN_111</dc:creator>
      <dc:date>2025-12-02T12:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate CSV blank lines (before &amp; after header) in Microsoft Fabric Data Pipelines?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4890691#M13816</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1447543" data-lia-user-login="PAVAN_111" class="lia-mention lia-mention-user"&gt;PAVAN_111&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the clarification — this changes the answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you &lt;STRONG&gt;must use ONLY Fabric Data Pipeline activities&lt;/STRONG&gt; (no notebook, no Dataflow Gen2), then this validation &lt;STRONG&gt;cannot be implemented fully&lt;/STRONG&gt; in Fabric today. Pipeline activities do not read files line-by-line and they do not expose file content in a way that allows you to detect blank rows before or after the header.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy activity, Lookup, Get Metadata, and other pipeline steps only work at the &lt;STRONG&gt;file or dataset level&lt;/STRONG&gt;, not at the &lt;STRONG&gt;row or line level&lt;/STRONG&gt;. They can check file existence, size, and schema, but they cannot inspect raw file content for formatting rules like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;– detecting blank rows&lt;BR /&gt;– locating the first non-blank header&lt;BR /&gt;– validating rows inside the file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no built-in pipeline activity that can scan the contents of a CSV and apply row-level validation logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So with your current restriction:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;You &lt;EM&gt;can&lt;/EM&gt; check file presence&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;You &lt;EM&gt;can&lt;/EM&gt; route files based on name/size&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;You &lt;EM&gt;cannot&lt;/EM&gt; validate blank lines&lt;/LI&gt;&lt;LI&gt;You &lt;EM&gt;cannot&lt;/EM&gt; inspect file contents&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;You &lt;EM&gt;cannot&lt;/EM&gt; identify header position&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;You &lt;EM&gt;cannot&lt;/EM&gt; flag row-level issues&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The only Fabrics tools that support this kind of validation are:&lt;BR /&gt;• Notebooks (Spark / Python)&lt;BR /&gt;• Dataflow Gen2&lt;BR /&gt;• External services (Logic Apps, Azure Functions, etc.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If none of those are allowed, then &lt;STRONG&gt;this requirement is not solvable in Fabric Pipelines alone&lt;/STRONG&gt; at the moment. The only correct design is to introduce &lt;EM&gt;one&lt;/EM&gt; processing step that can actually read file content.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want a workaround &lt;STRONG&gt;using pipelines only&lt;/STRONG&gt;, the closest you can get is:&lt;BR /&gt;copy the file into a staging area and mark it “unvalidated” until a downstream process validates it — but the validation itself cannot happen inside the pipeline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the honest answer is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;This requirement is not supported using Fabric pipelines alone today.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the design can be adjusted, the smallest change would be allowing one lightweight notebook for validation only.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;– Gopi Krishna&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Dec 2025 12:30:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4890691#M13816</guid>
      <dc:creator>Ugk161610</dc:creator>
      <dc:date>2025-12-02T12:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate CSV blank lines (before &amp; after header) in Microsoft Fabric Data Pipelines?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4890797#M13818</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1447543" data-lia-user-login="PAVAN_111" class="lia-mention lia-mention-user"&gt;PAVAN_111&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="920086" data-lia-user-login="Ugk161610" class="lia-mention lia-mention-user"&gt;Ugk161610&lt;/a&gt;&amp;nbsp;is correct, the best way to implement this is with a Notebook.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you must only use data pipelines, then you cannot achieve the desired result today.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the limitation for not using a notebook?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Dec 2025 14:27:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4890797#M13818</guid>
      <dc:creator>tayloramy</dc:creator>
      <dc:date>2025-12-02T14:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to validate CSV blank lines (before &amp; after header) in Microsoft Fabric Data Pipelines?</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4895355#M13913</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1447543" data-lia-user-login="PAVAN_111" class="lia-mention lia-mention-user"&gt;PAVAN_111&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1340679" data-lia-user-login="tayloramy" class="lia-mention lia-mention-user"&gt;tayloramy&lt;/a&gt;&amp;nbsp;&amp;amp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="920086" data-lia-user-login="Ugk161610" class="lia-mention lia-mention-user"&gt;Ugk161610&lt;/a&gt;&amp;nbsp;for sharing valuable insights.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for being part of the Microsoft Fabric Community.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 04:14:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/How-to-validate-CSV-blank-lines-before-amp-after-header-in/m-p/4895355#M13913</guid>
      <dc:creator>v-ssriganesh</dc:creator>
      <dc:date>2025-12-08T04:14:22Z</dc:date>
    </item>
  </channel>
</rss>

