hide all rows after row X

Viewed 696

Is it possible to hide all rows in a worksheet after a specified row?

library("openxlsx")

# Create a workbook.
wb <- createWorkbook()

# Add a worksheet.
addWorksheet(wb, sheetName = "test", gridLines = FALSE)

# "Hide" all rows after row 37.
setRowHeights(wb, 1, 38:1048576, 0)

# Write workbook.
saveWorkbook(wb, "test.xlsx", overwrite = TRUE)

# inspect file size.
file.info("test.xlsx")
#              size isdir mode               mtime               ctime               atime exe
# test.xlsx 2621280 FALSE  666 2018-09-13 14:54:10 2018-09-13 14:54:07 2018-09-13 14:54:07  no

Seems very inefficient and seems to make the output extremely large (and slow when trying to open it in Excel). I assume it's not hiding it and in fact just changing row heights to be 0?

0 Answers
Related