Forum Discussion

Manuel123's avatar
Manuel123
Helper I
5 years ago
Solved

Import Data from several Excel files

Dear Helpers,   I bet there is an easy solution for my problem I just don't find. I have several excel files in a sharepoint online folder and more files will come over time. Now I'd like to impor...
  • selimovd's avatar
    selimovd
    5 years ago

    Hey Manuel123 ,

     

    that should not be a problem. You can create the function with a local file (C:\...) and later just change the local vs the web content.

    After creating the transformations from the local file, the code in the advanced editor should begin like this:

    let
        Source = Excel.Workbook(File.Contents("C:\Users\myUser\OneDrive - myCompany\Projects\myFile.xlsx"), null, true),
    ...

     

    This you can change from File.Contents to Web.Contents:

    let
        Source = Excel.Workbook(Web.Contents("C:\Users\myUser\OneDrive - myCompany\Projects\myFile.xlsx"), null, true),
    ...

     

    Also you have to use the parameter. So you can change both at the same time.

    For example create a parameter PathToXLSX:

     

    And then you have to change it to Web.Contents and the parameter:

    let
        Source = Excel.Workbook(Web.Contents(PathToXLSX), null, true),
    ...

     

    Like this you can create the transformations with the local file. Later in the step 2 the parameter will be replaced by the full Sharepoint URL, something like:

    https://company-my.sharepoint.com/personal/myUser/Documents/Projects/myFile.xlsx

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis