Skip to contents

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
)

wb_get_thread(wb, sheet = current_sheet(), dims = NULL)

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()

Examples

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)