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
robertpedley1
New Member

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.

 

Capture.PNG

1 ACCEPTED SOLUTION
edhans
Super User
Super User

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.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

4 REPLIES 4
edhans
Super User
Super User

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.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
edhans
Super User
Super User

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.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

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

lbendlin
Super User
Super User

Does it work as a query in Power BI Desktop?

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