Skip to contents

This function lets the user download a file from Dropbox, specifying its name, using a previously created token or with interactive window.

Usage

db_download(
  query,
  local_path = NULL,
  xlsx = TRUE,
  token_dir = NA,
  token_name = "token_pers.rds",
  quiet = FALSE
)

Arguments

query

Search string. This string is split (on spaces) into individual words. Files will be used if they contain all words in the search string.

local_path

Character. Path to save file to. If NULL (the default), saves file to working directory with same name. If not, but a valid folder, file will be saved in this folder with same basename as path. If not NULL and not a folder, file will be saved to this path exactly.

xlsx

Boolean. Is it an Excel file? Can be returned as a list for each tab and not as a file if needed. Will delete downloaded file.

token_dir

Character. RDS with token local directory. You may set to NA if you already set your credentials (see get_creds())

token_name

Character. RDS file name with your token's data.

quiet

Boolean. Keep quiet? If not, show informative messages.

Value

If query returns a .xlsx file and xlsx=TRUE, will return a data.frame. Else, local_path string.

Examples

if (FALSE) { # \dontrun{
# Download a specific file
db_download("stocksReport.Rmd", local_path = "~/Desktop/generic.Rmd")
# Import an Excel file from Dropbox into a data.frame
df <- db_download("Portfolio LC.xlsx", xlsx = FALSE)
} # }