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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Python script not allowing me to schedule refresh

Hi all,

 

I have a Power BI report built from a dataflow (that I don't have admin access to). Within Power Query, I have applied a script to one of the tables from this flow. I have then published it to Power BI Service.

 

I am getting the below error:

harlanpost_0-1711465942331.png

 

As such, I suspect the issue is related to my Python script. I have a couple of questions:

1) Why can I not refresh the report in Power BI Service with this script?

2) Are there any workarounds I could use to avoid this? 

 

I'll leave the Python script below in case anybody has any insights. The script works perfectly when executed in Power Query.

 

Thank you in advance for the help!

 

 

import pandas as pd
import re
from datetime import datetime

def extract_and_standardize_date(text):
    if pd.isna(text) or text.strip() == '':
        return None

    date_pattern = r'\b(0?[1-9]|[12][0-9]|3[01])[-/. ](0?[1-9]|1[012]|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(?:[-/. ](\d{2}|\d{4}))?\b'
    match = re.search(date_pattern, text, re.IGNORECASE)

    if match:
        groups = match.groups()
        day = groups[0]
        month = groups[1]
        year = groups[2] if groups[2] else str(datetime.now().year)  # Use current year if year is missing

        if month.isalpha():
            datetime_object = datetime.strptime(month, "%b")
            month = datetime_object.month

        if len(year) == 2:
            year = '20' + year

        return f"{day.zfill(2)}/{str(month).zfill(2)}/{year}"

    return None



dataset['standardized_date'] = dataset['Column_X'].apply(extract_and_standardize_date)

dataset

 

 

3 REPLIES 3
Anonymous
Not applicable

Thanks for the response.

 

I don't seem to have the ability to create a personal gateway. 

harlanpost_0-1711472632854.png

Could this be a result of the fact I'm using a dataflow?

You need to do things the other way round.  First install and run the personal gateway and then use it in a dataflow.

lbendlin
Super User
Super User

Python and R scripts and visuals mandate the use of a personal gateway.

Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.