Skip to content

Long strings in formula are not allowed #91

@billdenney

Description

@billdenney

Excel only supports up to 255 characters in a formula, but we may write more than that. I would suggest we implement the suggested use of the =CONCATENTATE() function to break up longer strings.

To see the issue in Excel directly, put this formula in: ="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" (256 characters of "A")

library(writexl)
# Excel allows a maximum of 255 characters in a formula
d <- data.frame(A = xl_formula(paste0('="', paste(rep("A", 256), collapse = ""), '"')))
# This file will open with an error because only 255 characters are allowed in a
# formula.
check_file_long_formula <- write_xlsx(d)

Created on 2025-09-15 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions