Update existing records in the given table. The data is a data.frame.
update_records(api, table_id, record_dicts)
TRUE
if the transaction was sucessfull.
Other function_gristapi:
add_records()
,
countrows()
,
delete_records()
,
fetch_table()
,
listcolumns()
,
listtables()
,
sync_table()
# update data in a given table
library(dplyr)
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")
)
row_to_up <- fetch_table(api, table_name, filters = 'filter={"names": ["Merc 280"]}')
row_to_up <- row_to_up |> mutate(names = paste0(names,' - car for sale'))
update_records(api, table_name, row_to_up)
#> [1] TRUE