Forum Discussion
save data to .csv
- Anonymous2 years ago
Hi again Anonymous
Thanks for using Fabric Community.
Unfortunately, Fabric Dataflow (Gen2) itself doesn't have a built-in functionality to directly save the transformed data as an CSV file. However, you can achieve this by integrating Dataflow with Notebooks:
1) Give the destination as lakehouse in Dataflow Gen2 and publish the Dataflow . This will create a new table in your lakehouse.
2) Create a new notebook and run the below code:df = spark.sql("SELECT * FROM lakehouse_1.customers_1000 ")df.write.option("header",True).csv("Files/customersnew.csv")3) A file will be created in the lakehouse files section:
Hope this helps. Please let me know if you have any further questions.
Hi again Anonymous
Thanks for using Fabric Community.
Unfortunately, Fabric Dataflow (Gen2) itself doesn't have a built-in functionality to directly save the transformed data as an CSV file. However, you can achieve this by integrating Dataflow with Notebooks:
1) Give the destination as lakehouse in Dataflow Gen2 and publish the Dataflow . This will create a new table in your lakehouse.
2) Create a new notebook and run the below code:
Hope this helps. Please let me know if you have any further questions.
- Marcel_A2 years agoNew Member
By any chance do you if the Notebook code can be updated to dynamically append the field "File_Instance" to the output name?
- frithjof_v2 years agoCommunity Champion
If I understand correctly, this approach will create a folder with multiple files.
To create a single file from a Notebook, please refer to these threads:
I also think NandanHegde's solution is a good solution which doesn't involve Notebook.