Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
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.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.