This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
I have a parameter called "File" and the follow Python script:
# 'dataset' holds the input data for this script
import pandas
data = pandas.DataFrame(dataset)
data.to_csv('C:/Users/MyName/Desktop/'"&File&"'.csv')
I have based my solution on this post, but it doesn't work.
What am I doing wrong? How can I get the script to save the file with the parameter name?
Solved! Go to Solution.
I assume you are doing this as part of your query (instead of through a Python visual, in which your parameter wouldn't get passed). Does it work with you hard code in a file name? If that is working, I would edit the M code in the Advanced Editor instead of in the pop-up window. There you should be able to replace the hard-coded filename with "&File&" (I assume the whole Python code is surrounded in double quotes in Advanced Editor and this will break it apart and insert in your paramter value.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
I assume you are doing this as part of your query (instead of through a Python visual, in which your parameter wouldn't get passed). Does it work with you hard code in a file name? If that is working, I would edit the M code in the Advanced Editor instead of in the pop-up window. There you should be able to replace the hard-coded filename with "&File&" (I assume the whole Python code is surrounded in double quotes in Advanced Editor and this will break it apart and insert in your paramter value.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 34 | |
| 31 | |
| 25 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 61 | |
| 49 | |
| 28 | |
| 23 | |
| 23 |