Instantly share code, notes, and snippets.

Embed
What would you like to do?
Saving Internet Files with Power BI Desktop.pq
#Define download file
URL <- "https://www.six-swiss-exchange.com/shares/companies/download/issuers_all_en.csv"
#Define Destination - use forward slash instead of back slash!
mainDir <- "c:/"
subDir <- "Power BI/"
subDir2 <- "Securities"
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=";")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment