JackDanIce
Well-known Member
- Joined
- Feb 3, 2010
- Messages
- 9,922
- Office Version
- 365
- Platform
- Windows
Hi,
I'm using my PC and my laptop, both connected to a personal OneDrive account. Microsoft 365 (personal version, non scripts anyway)
I have code like:
Code is trying to read data from a personal cloud folder, which is mapped to each machine as paths imply, difference 1 folder name JackDan vs Admin.
When I open this file on my laptop, the csv file loads in fine.
When I open it on my pc, the csv file does not load in, nor does the laptop equivalent.
If I switch positions of the paths in the statement, close, then open on each machine, I get the opposite behaviour, csv data loads file into PC, but not laptop
First reaction is I have syntax wrong, but I am not getting any syntax errors
Second reaction, I have the paths wrong, but if I use Data->From Text/CSV as separate queries from both machines, the paths in the generated code are identical.
Third reaction, if try fails, otherwise should catch error and continue but I'm finding data is only read in from the machine I'm at, IF the path to the needed CSV file is after try, not otherwise.
So far workaround has been two separate queries
Then a 3rd query that is like
So far this set up is the only way I can easily open the Excel file and read in the data as needed.
Any ideas what I'm doing wrong or what's causing this behaviour and how to resolve?
TIA,
Jack
I'm using my PC and my laptop, both connected to a personal OneDrive account. Microsoft 365 (personal version, non scripts anyway)
I have code like:
Power Query:
let
Source = try
Csv.Document(File.Contents("C:\Users\JackDanOneDrive\Work\Karrus Capital\Earthi\Data\Copper Futures Historical Data.csv"), [Delimiter=",", Columns=7, Encoding=65001, QuoteStyle=QuoteStyle.None])
otherwise
Csv.Document(File.Contents("C:\Users\Admin\OneDrive\Work\Karrus Capital\Earthi\Data\Copper Futures Historical Data.csv"),[Delimiter=",", Columns=7, Encoding=65001, QuoteStyle=QuoteStyle.None]),
When I open this file on my laptop, the csv file loads in fine.
When I open it on my pc, the csv file does not load in, nor does the laptop equivalent.
If I switch positions of the paths in the statement, close, then open on each machine, I get the opposite behaviour, csv data loads file into PC, but not laptop
Power Query:
let
Source = try
Csv.Document(File.Contents("C:\Users\\OneDrive\Work\Data\Copper Futures Historical Data.csv"),[Delimiter=",", Columns=7, Encoding=65001, QuoteStyle=QuoteStyle.None])
otherwise
Csv.Document(File.Contents("C:\Users\JackDan[/COLOR]\OneDrive\Work\Data\Copper Futures Historical Data.csv"), [Delimiter=",", Columns=7, Encoding=65001, QuoteStyle=QuoteStyle.None]) ,
Second reaction, I have the paths wrong, but if I use Data->From Text/CSV as separate queries from both machines, the paths in the generated code are identical.
Third reaction, if try fails, otherwise should catch error and continue but I'm finding data is only read in from the machine I'm at, IF the path to the needed CSV file is after try, not otherwise.
So far workaround has been two separate queries
Then a 3rd query that is like
Power Query:
let
Source = try laptopcsv otherwise pccsv,
So far this set up is the only way I can easily open the Excel file and read in the data as needed.
Any ideas what I'm doing wrong or what's causing this behaviour and how to resolve?
TIA,
Jack