Learn R Programming

XLConnect (version 1.1.0)

extractSheetName: Extracting the sheet name from a formula

Description

Extracts the sheet name from a formula of the form <SHEET_NAME>!<CELL_ADDRESS>

Usage

extractSheetName(formula)

Value

Returns the name of the sheet referenced in the formula. For quoted sheet names (required if names contain e.g. whitespaces or exclamation marks (!)) in formulas the function returns the unquoted name.

Arguments

formula

Formula string of the form <SHEET_NAME>!<CELL_ADDRESS>. Note that the validity of the formula won't be checked.

Author

Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch

Examples

Run this code
if (FALSE) {
extractSheetName(c("MySheet!$A$1", "'My Sheet'!$A$1", "'My!Sheet'!$A$1"))
}

Run the code above in your browser using DataLab