Forum Discussion

JasonArmstrong's avatar
JasonArmstrong
Frequent Visitor
1 year ago
Solved

Dataflow Gen2 - Excel in SharePoint to Lakehouse - WriteToDataDestination Error

I have created a Dataflow Gen2 which uses my organisations On-Premises Gateway to connect to a SharePoint Site, navigate to the folder and files and export the excel workbook into Power Query, transf...
  • v-hashadapu's avatar
    v-hashadapu
    1 year ago

    Hi JasonArmstrong , Thank you for reaching out to the Microsoft Community Forum.

     

    The issue happens when a Dataflow writes to a Lakehouse table that already exists from a previous run. Even though you've set the update method to Replace, Fabric doesn't actually delete the physical OneLake path, it just tries to overwrite the files. If that path hasn't been fully released yet, which often occurs when Excel files are being ingested through an On-Prem Gateway, you’ll hit the “path already exists” error.

     

    When you write to a staging table instead, you’re usually creating a fresh, isolated target that isn’t reused or referenced elsewhere. That makes it far less likely to be locked or conflicted. And after the Dataflow finishes, you use a Spark notebook to drop and recreate the final table. Spark handles that clean-up at the storage level properly removing the folder and all contents in a way Dataflow doesn’t.

     

    You asked whether you could just drop the final table before running the Dataflow. Technically yes, but in practice it’s unreliable. OneLake can hold onto the storage path momentarily even after deletion and if the Dataflow tries to write before it’s fully cleared, the conflict returns. That’s why the staging pattern works better, the Dataflow runs without touching production and Spark takes care of the overwrite safely afterward. It’s not just moving the problem, it’s solving it by separating responsibilities between tools that handle them differently.

     

    If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
    Thank you.