Deletes records from the given table. The data is a vector of record IDs.

delete_records(api, table_id, record_ids)

Arguments

api

A 'gristapi::grist_api'-object

table_id

Normalized table name (see id in listtables method). First character upper. OBLIGATORY

record_ids

A vector of integers corresponding the id of the records to be deleted. OBLIGATORY

Value

TRUE if the transaction was successful.

See also

Other function_gristapi: add_records(), countrows(), fetch_table(), listcolumns(), listtables(), sync_table(), update_records()

Examples

# delete data in a given table
table_name <- paste0("Mtcars_",get_os())
api <- grist_api$new(
  server = 'https://grist.numerique.gouv.fr',
  api_key = Sys.getenv("GRIST_KEY"),
  doc_id = Sys.getenv("GRIST_DOC_TEST")
)
delete_records(api, table_name, as.integer(c(6)))
#> [1] TRUE