Learn R Programming

openxlsx2 (version 1.4)

wb_add_thread: Add threaded comments to a cell in a worksheet

Description

These functions allow adding thread comments to spreadsheets. This is not yet supported by all spreadsheet software. A threaded comment must be tied to a person created by wb_add_person().

Usage

wb_add_thread(
  wb,
  sheet = current_sheet(),
  dims = "A1",
  comment = NULL,
  person_id,
  reply = FALSE,
  resolve = FALSE
)

Arguments

wb

A workbook

sheet

A worksheet

dims

A cell

comment

The text to add, a character vector.

person_id

the person Id this should be added. The default is getOption("openxlsx2.thread_id") if set.

reply

Is the comment a reply? (default FALSE)

resolve

Should the comment be resolved? (default FALSE)

Details

If a threaded comment is added, it needs a person attached to it. The default is to create a person with provider id "None". Other providers are possible with specific values for id and user_id. If you require the following, create a workbook via spreadsheet software load it and get the values with wb_get_person()

See Also

wb_add_comment() person-wb

Other worksheet content functions: col_widths-wb, filter-wb, grouping-wb, named_region-wb, row_heights-wb, wb_add_conditional_formatting(), wb_add_data(), wb_add_data_table(), wb_add_formula(), wb_add_pivot_table(), wb_add_slicer(), wb_freeze_pane(), wb_merge_cells()

Examples

Run this code
wb <- wb_workbook()$add_worksheet()
# Add a person to the workbook.
wb$add_person(name = "someone who likes to edit workbooks")

pid <- wb$get_person(name = "someone who likes to edit workbooks")$id

# write a comment to a thread, reply to one and solve some
wb <- wb %>%
  wb_add_thread(dims = "A1", comment = "wow it works!", person_id = pid) %>%
  wb_add_thread(dims = "A2", comment = "indeed", person_id = pid, resolve = TRUE) %>%
  wb_add_thread(dims = "A1", comment = "so cool", person_id = pid, reply = TRUE)

Run the code above in your browser using DataLab