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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
STEV583
New Member

Schedule upload of daily csv files

Hi All,

 

Just getting my head around Power BI. We have a lot of legacy systems that provide us with daily files. I think I understand that you can mannually load and append this data to existing data. However, is it possible to automate this step?

 

Thanks 

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

Hi @STEV583,

You can use the Power BI PowerShell modules mentioned in this blog to automate the process that upload CSV files to Power BI. Below is the sample script. 

cls
 
$ErrorActionPreference = "Stop"
 
$currentPath = (Split-Path $MyInvocation.MyCommand.Definition -Parent)
 
 
 
#Create Archive Folder
 
new-item -Name "Archive" -Force -ItemType directory -Path "$currentPath\CSVData"  | Out-Null
 
Import-Module "$currentPath\Modules\PowerBIPS" -Force
 
while($true)
 
{
 
                # Iterate each CSV file and send to PowerBI
 
                Get-ChildItem "$currentPath\CSVData" -Filter "*.csv" |% {
 
                                $file=$_              
 
                                #Import csv and add column with filename
 
                                $data = Import-Csv $file.FullName | select @{Label="File";Expression={$file.Name}}, *
 
                                # Send data to PowerBI
 
                                $data |  Out-PowerBI -dataSetName "CSVSales" -tableName "Sales" -types @{"Sales.OrderDate"="datetime"; "Sales.SalesAmount"="double"; "Sales.Freight"="double"} -batchSize 300 -verbose
 
                                # Archive the file
 
                                Move-Item $file.FullName "$currentPath\CSVData\Archive\" -Force
 
                }
 
              
 
                Write-Output "Sleeping..."
 
                Sleep -Seconds 5
 
}


After you firstly upload csv files to Power BI, create report and dashboard using the new dataset,  when a new CSV file is dropped into the \CSVData directory, they will automatically be uploaded, the new data will be appended to the existing Power BI data and the dashboard will update without any manually operations.


Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BhaveshPatel
Community Champion
Community Champion

Yes, You can do this using the Gateway or The other best product I always used is Power Update. For more information, visit at this link

 

http://www.powerpivotpro.com/2015/02/introducing-power-update/

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.
STEV583
New Member

Hi All,

 

Just getting my head around Power BI. We have a lot of legacy systems that provide us with daily files. I think I understand that you can mannually load and append this data to existing data. However, is it possible to automate this step?

 

Thanks 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors