Skip to content

Option to use R1C1 references in writeFormula() #474

@ethan-crowell

Description

@ethan-crowell

Is your feature request related to a problem? Please describe.
When I use R1C1 cell references in writeFormula(), I am unable to open the resulting excel file without error. I have already verified that R1C1 references are enabled in my excel preferences and that I can use R1C1 referencing directly in excel.

Here is a minimum working example:

wb <- openxlsx::createWorkbook()
ws <- 'test_sheet'
openxlsx::addWorksheet(wb, sheetName = ws)
writeData(wb = wb, sheet = ws, x = 2, startCol = 1, startRow = 1)
writeData(wb = wb, sheet = ws, x = 4, startCol = 2, startRow = 1)
writeFormula(wb = wb, sheet = ws, x='=RC[-2] * RC[-1]', startCol = 3, startRow = 1)
saveWorkbook(wb, 'test.xlsx')

Describe the solution you'd like
The option to pass equations using R1C1 cell references in writeFormula.

Describe alternatives you've considered
The obvious alternative is to use the standard A1 referencing. However, R1C1 is much more convenient for some applications.

Additional context
Screenshots of excel error when I use R1C1:
Screenshot 2024-06-04 at 9 59 39 AM
Screenshot 2024-06-04 at 9 59 55 AM

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions