Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getDateOrigin

Get the date origin an xlsx file is using


Description

Return the date origin used internally by an xlsx or xlsm file

Usage

getDateOrigin(xlsxFile)

Arguments

xlsxFile

An xlsx or xlsm file.

Details

Excel stores dates as the number of days from either 1904-01-01 or 1900-01-01. This function checks the date origin being used in an Excel file and returns is so it can be used in convertToDate

Value

One of "1900-01-01" or "1904-01-01".

Author(s)

Alexander Walker

See Also

Examples

## create a file with some dates
## Not run: 
write.xlsx(as.Date("2015-01-10") - (0:4), file = "getDateOriginExample.xlsx")
m <- read.xlsx("getDateOriginExample.xlsx")

## convert to dates
do <- getDateOrigin(system.file("extdata", "readTest.xlsx", package = "openxlsx"))
convertToDate(m[[1]], do)

## End(Not run)

openxlsx

Read, Write and Edit xlsx Files

v4.2.3
MIT + file LICENSE
Authors
Philipp Schauberger [aut, cre], Alexander Walker [aut], Luca Braglia [ctb], Joshua Sturm [ctb]
Initial release
2020-10-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.