Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HansPeterPfister/aa5df3706a7e935f4a2a191b8efd7b21 to your computer and use it in GitHub Desktop.
Save HansPeterPfister/aa5df3706a7e935f4a2a191b8efd7b21 to your computer and use it in GitHub Desktop.
let
RScript =
"#Define download file #(lf)"
& "URL <- " & """" & SourceURL & SourceFileName & """#(lf)" // URL <- ""https://www.six-swiss-exchange.com/shares/companies/download/issuers_all_en.csv""
& "#Define Destination - use forward slash instead of back slash! #(lf)"
& "mainDir <- " & """" & mainDir & """#(lf)" // mainDir <- ""c:/""
& "subDir <- " & """" & subDir & """#(lf)" // subDir <- ""Power BI/""
& "subDir2 <- " & """" & subDir2 & """#(lf)" // subDir2 <- Securities/""
& "filename <- " & """" & filename & """#(lf)" // filename <- ""issuers.csv""
& "Destination <- paste(mainDir,subDir,subDir2, filename, sep="""")
#Create Destination, if it does not exist
dir.create(file.path(mainDir, subDir), showWarnings = FALSE)
dir.create(file.path(mainDir, subDir, subDir2), showWarnings = FALSE)
#Download the file to destination
download.file(URL, destfile = Destination, method = ""auto"", quiet=FALSE)
# Read CSV into R
MyData <- read.csv(file=Destination, header=TRUE, sep="";"")",
Quelle = R.Execute(RScript),
MyData = Quelle{[Name="MyData"]}[Value]
in
MyData
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment