From 39bf025f4be0bbf6b0b696f03038e94f065f1c98 Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Sun, 22 Oct 2023 19:11:54 +0200 Subject: [PATCH] Work around bug on blank cells with comment (#14) --- NEWS.md | 3 +++ R/xlsx_cutter.R | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 8b54721..64cb68a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # xlcutter (development version) +* `xlsx_cutter()` no longer fails when reading excel files with comments on + blank cells (#14, @Bisaloo). + # xlcutter 0.1.0 * Added a `NEWS.md` file to track changes to the package. diff --git a/R/xlsx_cutter.R b/R/xlsx_cutter.R index a6a20c1..d4c4a2d 100644 --- a/R/xlsx_cutter.R +++ b/R/xlsx_cutter.R @@ -86,9 +86,13 @@ single_xlsx_cutter <- function( d <- tidyxl::xlsx_cells( data_file, - sheets = data_sheet, - include_blank_cells = FALSE + sheets = data_sheet ) + # FIXME: this is not ideal because we'd rather not read blank cells at all + # by setting `include_blank_cells = FALSE` in `tidyxl::xlsx_cells()`. But + # this is currently failing in the case where we have blank cells with + # comments: https://github.com/nacnudus/tidyxl/issues/91 + d <- d[!d$is_blank, ] d <- merge(coords, d, all = FALSE, all.x = TRUE) d <- d[order(d$row, d$col), ]