Skip to content

Commit

Permalink
test new fun to open dictionary in excel
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr committed Oct 20, 2024
1 parent 3a3fab5 commit 14a9f8a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/tests_rafa/open_dictionary.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

download_and_open_excel <- function(url) {
# Extract the file name from the URL
destfile <- basename(url)

# Download the file
download.file(url, destfile, mode = "wb") # Use mode = "wb" for binary files like Excel

# Open the file based on the operating system
if (.Platform$OS.type == "windows") {
# For Windows
shell.exec(destfile)
} else if (Sys.info()["sysname"] == "Darwin") {
# For macOS
system(paste("open", shQuote(destfile)))
} else {
# For Unix/Linux
system(paste("xdg-open", shQuote(destfile)))
}
}

0 comments on commit 14a9f8a

Please sign in to comment.