Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added function to update spreadsheet headers in Python #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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