Forum Discussion

robertpedley1's avatar
robertpedley1
New Member
5 years ago
Solved

Unexpected error when trying to add data from csv to CDS

Hi I have a simple csv that is stored in one drive that I want to use dataflow (power query) to add to a table I have in the CDS. When i get to the last step i get an error:

 

section Section1;
shared Query = let
Source = Csv.Document(Web.Contents("https://company-my.sharepoint.com/personal//Documents/Documents/User Skills/document.csv"), [Delimiter = ",", Columns = 10, Encoding = 65001, QuoteStyle = QuoteStyle.None]),
#"Promoted headers" = Table.PromoteHeaders(Source, [PromoteAllScalars = true])
in
#"Promoted headers";

 

Any help will be appreciated.

 

  • Because a CSV stored on your hard drive would have this source line:

    Source = Csv.Document(File.Contents("C:\Users\path\Book2.csv"),[Delimiter=",", Columns=3, Encoding=65001, QuoteStyle=QuoteStyle.None])

    You have Web.Contents, so it looks like you are opening the file from a onedrive path in a web page, and web pages require a gateway.

    If it is onedrive for Business, use the SharePoint connector. Go to OneDrive in your browser in your Office 365 (business) tenant and grab the URL. It will look like this:

    https://TenentName-my.sharepoint.com/personal/user_name_tenentname_com/

    Put that in a SharePoint Folder connector and get your file. 

    That will not work with OneDrive personal, only business accounts.

4 Replies

  • edhans's avatar
    edhans
    Community Champion

    Do you have a gateway setup? You cannot access web connections via a normal cloud connection. Has to go through an on-prem gateway so admins can control what data goes in the reports.

    • robertpedley1's avatar
      robertpedley1
      New Member

      Hi I do not have a gateay, the csv file is stored in one drive so why would I need a gateway?

  • edhans's avatar
    edhans
    Community Champion

    Because a CSV stored on your hard drive would have this source line:

    Source = Csv.Document(File.Contents("C:\Users\path\Book2.csv"),[Delimiter=",", Columns=3, Encoding=65001, QuoteStyle=QuoteStyle.None])

    You have Web.Contents, so it looks like you are opening the file from a onedrive path in a web page, and web pages require a gateway.

    If it is onedrive for Business, use the SharePoint connector. Go to OneDrive in your browser in your Office 365 (business) tenant and grab the URL. It will look like this:

    https://TenentName-my.sharepoint.com/personal/user_name_tenentname_com/

    Put that in a SharePoint Folder connector and get your file. 

    That will not work with OneDrive personal, only business accounts.