Quantcast
Channel: Power Query topics
Viewing all articles
Browse latest Browse all 31015

Schedule Refresh of Excel files in folder

$
0
0

Hi,

 

I am trying to build a model that should include data from Excel files in a folder. All files are structured the same but have data for different years. I have installed the Data Gateway and added the folder as a source, but when I try to schedule refresh on the model I get this message: "You can't schedule refresh for this dataset because one or more sources currently don't support refresh".

 

I have used a technique that I have previously used for merging data from multiple SQL databases into a single table.

This is my code:

let
    Source = Folder.Files("NameOfFolder"),
    MergeFolderFile = Table.AddColumn(Source, "Files", each [Folder Path] & [Name]),
    FilesToLoad = Table.Column(MergeFolderFile, "Files"),
    FilesLoop = (FilesToLoad as text) =>

let

    Source = Excel.Workbook(File.Contents(FilesToLoad), null, true),
    Sheet = Source{[Item="NameOfSheet",Kind="Sheet"]}[Data],
    PromotedHeaders = Table.PromoteHeaders(Sheet, [PromoteAllScalars=true])

in    

    PromotedHeaders,
    LoadFiles = List.Transform(FilesToLoad, each FilesLoop(_)),
    CombineFiles = Table.Combine(LoadFiles)
in CombineFiles

 

It's it possible at all to schedule refresh of files in a folder? If it isn't it doesn't make sence that the gateway allows to me to add a folder as a source. 


Viewing all articles
Browse latest Browse all 31015

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>