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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
zhanna27
Frequent Visitor

Append dataset from powerbi service to sharepoint

Hello Community,

I'm struggling to append a dataset from powerbi service to an external source on my sharepoint. This sharepoint csv document  contains some archived data. I need to append new daily data each day to this .csv sharepoint document and I need to use my powerbi dataset for that which works fine and gives me the data for the day before yesterday. 

Is that possible ? 

I tried to write a code but it doesn't work :  

// Function to retrieve data from the API

let

    Limit = 10000,

    Query = (offset) =>

    let

        Source = Json.Document(Web.Contents(api site, [

            Query = [

                limit = Number.ToText(Limit),

                offset = Text.From(offset), // Convert offset to text

                auth = "some_token",

                startDate = Date.ToText(DateTime.Date(Date.AddDays(DateTime.LocalNow(), -2)), "yyyy-MM-dd"),

                endDate = Date.ToText(DateTime.Date(Date.AddDays(DateTime.LocalNow(), -1)), "yyyy-MM-dd")

            ]

        ]))

    in

        Source,

 

    // Load existing data from SharePoint .csv file

    SharePointCSV = Csv.Document(Web.Contents(update.csv), ",", QuoteStyle.None),

 

    // Determine if headers need to be included

    IncludeHeaders = Table.IsEmpty(SharePointCSV),

 

    // Call the function with an offset of 0

    Source1 = Query(0),

 

    // Merge new data with existing data

    MergedData = if Table.IsEmpty(SharePointCSV) then Source1 else Table.Combine({SharePointCSV, Source1}),

 

    // Convert to CSV text

    CsvText = Text.Combine({if IncludeHeaders then Text.Combine(Table.ColumnNames(MergedData), ",") else "", Text.Combine(List.Transform(Table.ToRecords(MergedData), each Text.Combine(Record.FieldValues(_), ",")), Character.FromNumber(13) & Character.FromNumber(10))}),

 

    // Upload the updated .csv back to SharePoint

    SharePointURL = sharepoint.update.csv,

    Upload = Web.Contents(SharePointURL, [Content=Text.ToBinary(CsvText), Headers=[#"Content-Type"="text/csv"]])

in

    Upload

 

Is threre a possibility maybe with incremental refresh but I I clearly see that no possible dataset saving possible on powerbi service and we have to use exterior storage. Do you confirm or maybe I miss something ? 

Thank you for your help. 

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @zhanna27 ,

Appending new data from Power BI to a SharePoint CSV file is not a native feature of Power BI service. Please consider using Power Automate or Power BI Desktop.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

Hi @v-cgao-msft 

thank you for your reply. Can you please tell me how can we do this processs via powerbi Desktop? I need the data for the day before yesterday to be added to the file on my desktop every day and without headers. How can you automate it via powerbi desktop ? 

thank you.  

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Kudoed Authors