From d0363e347c36fb2c4f4e061b37f247365ac42cd6 Mon Sep 17 00:00:00 2001 From: akskha Date: Wed, 13 Feb 2019 16:54:58 -0600 Subject: [PATCH] Added function to update spreadsheet headers --- python/quip.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/python/quip.py b/python/quip.py index ac35ecb..ef0f9b4 100644 --- a/python/quip.py +++ b/python/quip.py @@ -474,6 +474,25 @@ def add_to_spreadsheet(self, thread_id, *rows, **kwargs): section_id=section_id, operation=operation) + + def update_spreadsheet_headers(self, thread_id, *headers, **kwargs): + """Updates the headers of the named (or first) spreadsheet in the + given document. + client = quip.QuipClient(...) + client.add_to_spreadsheet(thread_id, "Header1", "Header2", "Header3") + """ + content = "".join(["%s" % header for header in headers]) + if kwargs.get("name"): + spreadsheet = self.get_named_spreadsheet(kwargs["name"], thread_id) + else: + spreadsheet = self.get_first_spreadsheet(thread_id) + section_id = self.get_first_row_item_id(spreadsheet) + return self.edit_document( + thread_id=thread_id, + content=content, + section_id=section_id, + operation=self.PREPEND) + def update_spreadsheet_row(self, thread_id, header, value, updates, **args): """Finds the row where the given header column is the given value, and applies the given updates. Updates is a dict from header to