Skip to content

Commit

Permalink
Added function to update spreadsheet headers
Browse files Browse the repository at this point in the history
  • Loading branch information
akskha committed Feb 13, 2019
1 parent cfa97b9 commit d0363e3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions python/quip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(["<td>%s</td>" % 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
Expand Down

0 comments on commit d0363e3

Please sign in to comment.