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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Python Script with widgets

Hello, I am pretty new on power Bi and Python, I am trying to use a scrip to read around 300 excel files and append or concat them but once those file have been appended, 99% of the time I wont need to read them again so just in case I did a scrip with a check box that let me decide if I want or not to read again all historical data, It works on anaconda notebook but when I try to run it in Power BI I got 

 

Details: "ADO.NET: Python script error.
<pi>NameError: name 'display' is not defined
</pi>"  

 

The Script :

 

import ipywidgets as widgets
import os
import pandas as pd

import glob 

 

path_data=r'C:\Users\xxxxx\Desktop\All'

 

check=widgets.Checkbox(value=False,
description='Refresh Historic Data',
disabled=False,
indent=False)
display(check)

 

if check.value ==False:
path_data=r'C:\Users\m0188842\Desktop\All\1'
elif check.value ==True:
path_data=r'C:\Users\m0188842\Desktop\All'

 

os.chdir(path_data) 

filenames = glob.glob('*.xlsm*') 

df_final = pd.DataFrame() 
for file in filenames: 


df = pd.read_excel(file, sheet_name='Consolidation') 
df_final=pd.concat([df,df_final],ignore_index=True)

df_final.to_csv(os.path.join(path_data, 'Test1.csv'), index=False)

 

 

The question is Can I sue widgets on Power Bi?

Thank you!

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You can only use the default renderer. No other renderers are permitted.

If you run this in Power Query then there is no renderer at all.  Comment out that line.  You cannot have any UI during the Power Query part.

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

You can only use the default renderer. No other renderers are permitted.

If you run this in Power Query then there is no renderer at all.  Comment out that line.  You cannot have any UI during the Power Query part.

Helpful resources

Announcements
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.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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