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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Msoede
Frequent Visitor

Csv Python Fabric

Hi, 


Hopefully someone can help me out with the following. I want to create a csv file from a query in Fabric (being to big for Excel). Do I need to create such a csv with Python or are there other possibilities? Could someone help me out with a script to extra data to csv from Fabric?

 

Many thanks,

Michiel

1 ACCEPTED SOLUTION
nilendraFabric
Super User
Super User

Hello @Msoede 

 

Please give it a try:

 


df = spark.sql("YOUR SQL QUERY HERE")

# Save the Spark DataFrame as a CSV file
df.write \
.option("header", "true") \
.option("delimiter", ",") \
.mode("overwrite") \
.csv("/lakehouse/default/Files/your_file_name.csv")

 

 

View solution in original post

2 REPLIES 2
v-menakakota
Community Support
Community Support

Hi @Msoede ,

Thank you for reaching out to us on the Microsoft Fabric Community Forum.

You can create a CSV file from a query in Fabric
Providing the reference thread which may assist you in addressing the query:
Solved: save data to .csv - Microsoft Fabric Community

If this post was helpful, please give us Kudos and consider marking Accept as solution to assist other members in finding it more easily.

Regards,
Menaka



nilendraFabric
Super User
Super User

Hello @Msoede 

 

Please give it a try:

 


df = spark.sql("YOUR SQL QUERY HERE")

# Save the Spark DataFrame as a CSV file
df.write \
.option("header", "true") \
.option("delimiter", ",") \
.mode("overwrite") \
.csv("/lakehouse/default/Files/your_file_name.csv")

 

 

Helpful resources

Announcements
FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

March Fabric Update Carousel

Fabric Monthly Update - March 2026

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