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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Sharmilshah
Frequent Visitor

Write Back data from PowerBI to SharePoint

Hi all,
I'm working on a Power BI report where users need to update a SharePoint list by clicking a Power Automate button. I have everything working when values are selected from slicers or table visuals (like Request ID, Status, etc.).
However, I'm stuck on how to let the user enter free text input (like a comment) and pass that into the Power Automate flow.


⚙️ Setup so far:

  1. Power BI visual has fields: RequestID, Status (from slicer)
  2. Power Automate visual is configured and updates SharePoint successfully when using predefined values
  3. No Power Apps is being used — I want to keep everything inside Power BI

🧩 Problem:

  • There's no native free text input in Power BI
  • I can't figure out how to let the user type a custom comment and pass it to the flow
  • Tried using slicers or prebuilt tables, but they only support static values

Is there any workaround or clean way to collect user-entered text (like a comment) inside Power BI and pass it dynamically into a Power Automate flow?
Appreciate any help or best practices!
Thanks!

2 ACCEPTED SOLUTIONS

hey, @Sharmilshah ,

You can still use user defined function, you just need to call graph api with delegated access to sharepoint list.

 

However, you essentially need a registered app with permission to access SharePoint's Graph API to share with the sites you need. Should be delegated per site, it can look like this:

vojtechsima_0-1753348821029.png

Depends on your admins, but they can grant you this.

 

And once you have this, you can call graph's rest api for SharePoint, I don't have code at end, but I vibe coded something like this (please note, it can be wrong, just an idea):

import fabric.functions as fn
import logging
import requests

udf = fn.UserDataFunctions()

@udf.connection(argName="sharepoint", alias="mysharepoint")
@udf.function()
def UpdateSharePointComment(
    sharepoint: fn.FabricGenericConnection,  # Use the right connection type for your setup
    site_url: str,
    list_name: str,
    item_id: int,
    comment: str,
    access_token: str  # Ideally, get this securely or use Managed Identity if possible
) -> str:
    logging.info("Processing UpdateSharePointComment")

    # Validation
    if not comment or not comment.strip():
        raise fn.UserThrownError("Comment cannot be empty.")

    # Compose SharePoint API URL
    url = f"{site_url}/_api/web/lists/getbytitle('{list_name}')/items({item_id})"

    headers = {
        "Authorization": f"Bearer {access_token}",
        "Accept": "application/json;odata=verbose",
        "Content-Type": "application/json"
    }

    # SharePoint expects a PATCH for updates
    data = {
        "__metadata": {"type": "SP.Data.YourListNameListItem"},  # You must specify the internal list item type
        "Comment": comment  # Change to your column's internal name
    }

    # PATCH request
    response = requests.post(
        url,
        headers=headers,
        json=data,
        params={"$select": "Id"}
    )

    if response.status_code not in (200, 204):
        raise fn.UserThrownError(f"SharePoint update failed: {response.text}")

    return f"SharePoint item {item_id} updated with comment '{comment}'."



View solution in original post

v-veshwara-msft
Community Support
Community Support

Hi @Sharmilshah ,

Thanks for posting in Microsoft Fabric Community.

Just checking in to see if have you had a chance to review the information provided by @vojtechsima.

As mentioned, since you're using a workspace with Fabric capacity, you're in a good position to take advantage of the Text Slicer (preview). This allows users to enter free text directly in Power BI, which can then be passed into a User-Defined Function and used within a Translytical Task Flow to update the SharePoint list.

 

The blog shared earlier by @vojtechsima walks through how to set up native writeback using Fabric, which is relevant for your scenario.

Also as suggested, to write back directly to a SharePoint list, you can use the Graph API. This does require registering an app with the necessary delegated permissions to access the SharePoint site, but once configured, it allows you to update list items, including custom fields like comments.

 

Please reach out for further assistance.

 

Also thanks @speedramps for suggesting Power Apps and providing helpful resources. This helps others with similar requirement.

 

Regards.

 

 

 

 

View solution in original post

8 REPLIES 8
v-veshwara-msft
Community Support
Community Support

Hi @Sharmilshah ,
We wanted to kindly follow up regarding your query. If you need any further assistance, please reach out.
Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @Sharmilshah ,
Just wanted to check if the responses provided were helpful. If further assistance is needed, please reach out.
Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @Sharmilshah ,
We wanted to kindly follow up regarding your query. If you need any further assistance, please reach out.
Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @Sharmilshah ,

Thanks for posting in Microsoft Fabric Community.

Just checking in to see if have you had a chance to review the information provided by @vojtechsima.

As mentioned, since you're using a workspace with Fabric capacity, you're in a good position to take advantage of the Text Slicer (preview). This allows users to enter free text directly in Power BI, which can then be passed into a User-Defined Function and used within a Translytical Task Flow to update the SharePoint list.

 

The blog shared earlier by @vojtechsima walks through how to set up native writeback using Fabric, which is relevant for your scenario.

Also as suggested, to write back directly to a SharePoint list, you can use the Graph API. This does require registering an app with the necessary delegated permissions to access the SharePoint site, but once configured, it allows you to update list items, including custom fields like comments.

 

Please reach out for further assistance.

 

Also thanks @speedramps for suggesting Power Apps and providing helpful resources. This helps others with similar requirement.

 

Regards.

 

 

 

 

vojtechsima
Super User
Super User

Hey, @Sharmilshah ,

Sounds like a perfect use case for Fabric's user-defined functions and Translytical task flows.

 

Power BI now using new Text Slicer as Text Input and you can map it to an action that will write back to your source, it just needs a bit of setup and fabric licence/capacity.

 

Check out this blog:

https://www.vojtechsima.com/post/native-write-back-in-power-bi-fabric-preview

Thank you @vojtechsima  for sharing the TTF option. Your details are excellent. In my use case, I have a sharepoint list as a datasource. I can pull data into Fabric (as I have workspace with Fabric capacity) but my intention is not to just write back to Fabric but want to update end source which is SharePoint list also. I tried to figure out a solution but couldn't find a direct way.

hey, @Sharmilshah ,

You can still use user defined function, you just need to call graph api with delegated access to sharepoint list.

 

However, you essentially need a registered app with permission to access SharePoint's Graph API to share with the sites you need. Should be delegated per site, it can look like this:

vojtechsima_0-1753348821029.png

Depends on your admins, but they can grant you this.

 

And once you have this, you can call graph's rest api for SharePoint, I don't have code at end, but I vibe coded something like this (please note, it can be wrong, just an idea):

import fabric.functions as fn
import logging
import requests

udf = fn.UserDataFunctions()

@udf.connection(argName="sharepoint", alias="mysharepoint")
@udf.function()
def UpdateSharePointComment(
    sharepoint: fn.FabricGenericConnection,  # Use the right connection type for your setup
    site_url: str,
    list_name: str,
    item_id: int,
    comment: str,
    access_token: str  # Ideally, get this securely or use Managed Identity if possible
) -> str:
    logging.info("Processing UpdateSharePointComment")

    # Validation
    if not comment or not comment.strip():
        raise fn.UserThrownError("Comment cannot be empty.")

    # Compose SharePoint API URL
    url = f"{site_url}/_api/web/lists/getbytitle('{list_name}')/items({item_id})"

    headers = {
        "Authorization": f"Bearer {access_token}",
        "Accept": "application/json;odata=verbose",
        "Content-Type": "application/json"
    }

    # SharePoint expects a PATCH for updates
    data = {
        "__metadata": {"type": "SP.Data.YourListNameListItem"},  # You must specify the internal list item type
        "Comment": comment  # Change to your column's internal name
    }

    # PATCH request
    response = requests.post(
        url,
        headers=headers,
        json=data,
        params={"$select": "Id"}
    )

    if response.status_code not in (200, 204):
        raise fn.UserThrownError(f"SharePoint update failed: {response.text}")

    return f"SharePoint item {item_id} updated with comment '{comment}'."



speedramps
Super User
Super User

Consider usiing a Power App visual inside Power BI

learn how for free here

 

Please click thumbs up because I have tried to help.

Then click [accept solution] if it works.

(It does works, I have used it lots of times and it does exactly what you want).

However, SharePoint is anot the best choice.

Consider using Dataverse or SQL

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.