Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
ShivaniTyagi01
Frequent Visitor

convert .cns file read from sharepoint to .csv in dataflow gen2

Hi,

 

I am new to MS fabric.

I have a requirement where I have got the data from my sharepoint folder and the files are in .cns format which is actually .csv format if you open the file. But the query is not reading the file . How should I convert the file from .cns to .csv in dataflow gen2 ?

 

Thanks,

Shivani Tyagi

1 ACCEPTED SOLUTION
prasbharat
Frequent Visitor

Hi,

Great question! Here how i think you can resolve the issue with .cns files in Microsoft Fabric Dataflow Gen2. Since .cns files are essentially .csv files, we need to ensure Dataflow Gen2 can recognize and process them correctly. There are two options you can choose from based on your preference. let me know if this works and update which one you had considered & working and finanlly mark as resolved if you are fine with provided solution.


Option 1: Rename .cns Files to .csv in SharePoint

If renaming the files is feasible, this option will allow Dataflow Gen2 to natively recognize them as CSV files.

  1. Automate Renaming with Power Automate:
    • Set up a Power Automate flow to monitor the SharePoint folder for .cns files.
    • Automatically rename the files by replacing the .cns extension with .csv.
  2. Load .csv Files in Dataflow Gen2:
    • Once the files are renamed, connect your Dataflow Gen2 to the SharePoint folder.
    • Process the renamed .csv files without any additional steps.

This option is straightforward if you have many .cns files and renaming them upfront is not an issue.


Option 2: Process .cns Files Directly in Dataflow Gen2

If renaming is not an option, you can configure Dataflow Gen2 to recognize and process .cns files as CSV files.

  1. Connect to the SharePoint Folder:

    • Use the SharePoint Folder Connector in Dataflow Gen2 to load the .cns files.
  2. Filter for .cns Files:

    • In the Power Query editor, filter files with the .cns extension:
      powerquery
      Copy code
      Table.SelectRows(Source, each Text.EndsWith([Name], ".cns"))
  3. Parse .cns Files as CSV:

    • Add a transformation step to parse the .cns file content as CSV:
      powerquery
      Copy code
      Csv.Document(File.Contents([Folder Path] & [Name]), [Delimiter=","])
      Replace "," with the appropriate delimiter if your .cns files use a different one (e.g., tab).

This option allows you to process .cns files directly without needing to rename them.

View solution in original post

3 REPLIES 3
prasbharat
Frequent Visitor

Hi,

Great question! Here how i think you can resolve the issue with .cns files in Microsoft Fabric Dataflow Gen2. Since .cns files are essentially .csv files, we need to ensure Dataflow Gen2 can recognize and process them correctly. There are two options you can choose from based on your preference. let me know if this works and update which one you had considered & working and finanlly mark as resolved if you are fine with provided solution.


Option 1: Rename .cns Files to .csv in SharePoint

If renaming the files is feasible, this option will allow Dataflow Gen2 to natively recognize them as CSV files.

  1. Automate Renaming with Power Automate:
    • Set up a Power Automate flow to monitor the SharePoint folder for .cns files.
    • Automatically rename the files by replacing the .cns extension with .csv.
  2. Load .csv Files in Dataflow Gen2:
    • Once the files are renamed, connect your Dataflow Gen2 to the SharePoint folder.
    • Process the renamed .csv files without any additional steps.

This option is straightforward if you have many .cns files and renaming them upfront is not an issue.


Option 2: Process .cns Files Directly in Dataflow Gen2

If renaming is not an option, you can configure Dataflow Gen2 to recognize and process .cns files as CSV files.

  1. Connect to the SharePoint Folder:

    • Use the SharePoint Folder Connector in Dataflow Gen2 to load the .cns files.
  2. Filter for .cns Files:

    • In the Power Query editor, filter files with the .cns extension:
      powerquery
      Copy code
      Table.SelectRows(Source, each Text.EndsWith([Name], ".cns"))
  3. Parse .cns Files as CSV:

    • Add a transformation step to parse the .cns file content as CSV:
      powerquery
      Copy code
      Csv.Document(File.Contents([Folder Path] & [Name]), [Delimiter=","])
      Replace "," with the appropriate delimiter if your .cns files use a different one (e.g., tab).

This option allows you to process .cns files directly without needing to rename them.

prasbharat
Frequent Visitor

Hi,

Great question! Here how i think you can resolve the issue with .cns files in Microsoft Fabric Dataflow Gen2. Since .cns files are essentially .csv files, we need to ensure Dataflow Gen2 can recognize and process them correctly. There are two options you can choose from based on your preference. let me know if this works and update which one you had considered & working and finanlly mark as resolved if you are fine with provided solution.


Option 1: Rename .cns Files to .csv in SharePoint

If renaming the files is feasible, this option will allow Dataflow Gen2 to natively recognize them as CSV files.

  1. Automate Renaming with Power Automate:
    • Set up a Power Automate flow to monitor the SharePoint folder for .cns files.
    • Automatically rename the files by replacing the .cns extension with .csv.
  2. Load .csv Files in Dataflow Gen2:
    • Once the files are renamed, connect your Dataflow Gen2 to the SharePoint folder.
    • Process the renamed .csv files without any additional steps.

This option is straightforward if you have many .cns files and renaming them upfront is not an issue.


Option 2: Process .cns Files Directly in Dataflow Gen2

If renaming is not an option, you can configure Dataflow Gen2 to recognize and process .cns files as CSV files.

  1. Connect to the SharePoint Folder:

    • Use the SharePoint Folder Connector in Dataflow Gen2 to load the .cns files.
  2. Filter for .cns Files:

    • In the Power Query editor, filter files with the .cns extension:
      powerquery
      Copy code
      Table.SelectRows(Source, each Text.EndsWith([Name], ".cns"))
  3. Parse .cns Files as CSV:

    • Add a transformation step to parse the .cns file content as CSV:
      powerquery
      Copy code
      Csv.Document(File.Contents([Folder Path] & [Name]), [Delimiter=","])
      Replace "," with the appropriate delimiter if your .cns files use a different one (e.g., tab).

This option allows you to process .cns files directly without needing to rename them.

NandanHegde
Super User
Super User

Unfortunately, based on my understanding, Fabric Dataflow Gen 2 doesnt support this file extension to be read directly (so it wont be possible to convert it) via dataflow Gen 2.

You would have to do some custom coding for that conversion which you can achive via Fabric notebooks




----------------------------------------------------------------------------------------------
Nandan Hegde (MSFT Data MVP)
LinkedIn Profile : www.linkedin.com/in/nandan-hegde-4a195a66
GitHUB Profile : https://github.com/NandanHegde15
Twitter Profile : @nandan_hegde15
MSFT MVP Profile : https://mvp.microsoft.com/en-US/MVP/profile/8977819f-95fb-ed11-8f6d-000d3a560942
Topmate : https://topmate.io/nandan_hegde
Blog :https://datasharkx.wordpress.com

Helpful resources

Announcements
MarchFBCvideo - carousel

Fabric Monthly Update - March 2025

Check out the March 2025 Fabric update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

"); $(".slidesjs-pagination" ).prependTo(".pagination_sec"); $(".slidesjs-pagination" ).append("
"); $(".slidesjs-play.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-stop.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-pagination" ).append(""); $(".slidesjs-pagination" ).append(""); } catch(e){ } /* End: This code is added by iTalent as part of iTrack COMPL-455 */ $(".slidesjs-previous.slidesjs-navigation").attr('tabindex', '0'); $(".slidesjs-next.slidesjs-navigation").attr('tabindex', '0'); /* start: This code is added by iTalent as part of iTrack 1859082 */ $('.slidesjs-play.slidesjs-navigation').attr('id','playtitle'); $('.slidesjs-stop.slidesjs-navigation').attr('id','stoptitle'); $('.slidesjs-play.slidesjs-navigation').attr('role','tab'); $('.slidesjs-stop.slidesjs-navigation').attr('role','tab'); $('.slidesjs-play.slidesjs-navigation').attr('aria-describedby','tip1'); $('.slidesjs-stop.slidesjs-navigation').attr('aria-describedby','tip2'); /* End: This code is added by iTalent as part of iTrack 1859082 */ }); $(document).ready(function() { if($("#slides .item").length < 2 ) { /* Fixing Single Slide click issue (commented following code)*/ // $(".item").css("left","0px"); $(".item.slidesjs-slide").attr('style', 'left:0px !important'); $(".slidesjs-stop.slidesjs-navigation").trigger('click'); $(".slidesjs-previous").css("display", "none"); $(".slidesjs-next").css("display", "none"); } var items_length = $(".item.slidesjs-slide").length; $(".slidesjs-pagination-item > button").attr("aria-setsize",items_length); $(".slidesjs-next, .slidesjs-pagination-item button").attr("tabindex","-1"); $(".slidesjs-pagination-item button").attr("role", "tab"); $(".slidesjs-previous").attr("tabindex","-1"); $(".slidesjs-next").attr("aria-hidden","true"); $(".slidesjs-previous").attr("aria-hidden","true"); $(".slidesjs-next").attr("aria-label","Next"); $(".slidesjs-previous").attr("aria-label","Previous"); //$(".slidesjs-stop.slidesjs-navigation").attr("role","button"); //$(".slidesjs-play.slidesjs-navigation").attr("role","button"); $(".slidesjs-pagination").attr("role","tablist").attr("aria-busy","true"); $("li.slidesjs-pagination-item").attr("role","list"); $(".item.slidesjs-slide").attr("tabindex","-1"); $(".item.slidesjs-slide").attr("aria-label","item"); /*$(".slidesjs-stop.slidesjs-navigation").on('click', function() { var itemNumber = parseInt($('.slidesjs-pagination-item > a.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); });*/ $(".slidesjs-stop.slidesjs-navigation, .slidesjs-pagination-item > button").on('click keydown', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); var itemNumber = parseInt($('.slidesjs-pagination-item > button.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); }); $(".slidesjs-play.slidesjs-navigation").on('click', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); }); $(".slidesjs-pagination-item button").keyup(function(e){ var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); $(".slidesjs-stop.slidesjs-navigation").trigger('click').blur(); $("button.active").focus(); } }); $(".slidesjs-play").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-stop").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-play")) { $(".slidesjs-stop").focus(); } } }); $(".slidesjs-stop").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-play").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-stop")) { $(".slidesjs-play").focus(); } } }); $(".slidesjs-pagination-item").keydown(function(e){ switch (e.which){ case 37: //left arrow key $(".slidesjs-previous.slidesjs-navigation").trigger('click'); e.preventDefault(); break; case 39: //right arrow key $(".slidesjs-next.slidesjs-navigation").trigger('click'); e.preventDefault(); break; default: return; } $(".slidesjs-pagination-item button.active").focus(); }); }); // Start This code is added by iTalent as part of iTrack 1859082 $(document).ready(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); $("#tip2").attr("aria-hidden","true").addClass("hidden"); $(".slidesjs-stop.slidesjs-navigation, .slidesjs-play.slidesjs-navigation").attr('title', ''); $("a#playtitle").focus(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").mouseover(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").blur(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#playtitle").mouseleave(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#play").keydown(function(ev){ if (ev.which ==27) { $("#tip1").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); $("a#stoptitle").focus(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").mouseover(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").blur(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").mouseleave(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").keydown(function(ev){ if (ev.which ==27) { $("#tip2").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); }); // End This code is added by iTalent as part of iTrack 1859082