Long strings in formula are not allowed
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")
``` r
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)
```
<sup>Created on 2025-09-15 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup>
关闭于 2026-04-08 1 条评论