Convert the data of a table into a delimited text string. Save the string as a character vector or write it to a text file. This direct conversion makes it easy to read tables into R or a spreadsheet.

export_mdb(
  file,
  table,
  output = TRUE,
  delim = ",",
  quote = "\"",
  quote_escape = "double",
  col_names = TRUE,
  eol = "\n",
  date_format = "%Y-%m-%d %H:%M:%S"
)

Arguments

file

Path to the Microsoft Access file.

table

Name of the table, list with mdb_tables().

output

Path or connection to write to. Passed to the stdout argument of system2(). Possible values are "", to the R console (the default), NULL or FALSE (discard output), TRUE (capture the output in a character vector) or a character string naming a file.

delim

Delimiter used to separate values.

quote

Single character used to quote strings. Defaults to ".

quote_escape

The type of escaping to use for quoted values, one of "double", "backslash" or "none". You can also use FALSE, which is equivalent to "none". The default is "double", which is expected format for Excel.

col_names

If FALSE, column names will not be included at the top of the file. If TRUE, column names will be included.

eol

The end of line character to use. Most commonly either "\n" for Unix style newlines, or "\r\n" for Windows style newlines.

date_format

The format in which date columns are converted. MDB Tools uses the strftime(3) format, similar to readr::parse_date(). No need to specify whole string. Defaults to ISO8601.

Value

Character string, invisible if path to file.

Examples

if (FALSE) { # \dontrun{
export_mdb(mdb_example(), "Airlines", output = TRUE)
} # }