Skip to main content

I'm using the python automation to integrate an external data source (survey results) into quip.   I'm able to call the api and add rows, get the table-id, etc.  but I'm unable to add a spreadsheet column programatically.   I'd like to add a new column with a survey question as the heading if the survey question does not exist in the table yet.

 

I've tried AFTER_SECTION after the last heading id, but get an error.  I've also tried to update the entire document with REPLACE_SECTION and the table id,  but get an error to the effect of "body too large".   

 

Here is my latest try:

document = quip.get_thread(quip_spreadsheet_id)soup = BeautifulSoup(document['html'], 'html.parser')table = soup.find('table')if table is None:    print("No table found")    return# Find all heading rowsrows = table.find_all('tr')if not rows:    print("No rows found in the table")    return# Get the first rowfirst_row = rows[0]# Find all cells in the first row (headings)cells = first_row.find_all(['th', 'td'])if not cells:    print("No cells found in the first row")    return# header rows are now in cellsheaders = []headerIds = []for i, cell in enumerate(cells):    if i == 0: continue    content = cell.get_text(strip=True)    headers.append(content)    headerIds.append(cell.get('id'))last_id = headerIds[-1]header = "newHeader"print(f'adding header: {header}')response = quip.edit_document(    thread_id=quip_spreadsheet_id,    format="markdown",    content=header,    section_id=last_id,    operation=quip.AFTER_SECTION)print(response)

 

Is there some incantation of /edit-document that can be used to add a spreadsheet column? 

 

#Quip

 

@* Quip *

2 answers
  1. Dec 30, 2024, 4:20 PM

    Thanks @Ashwini Garwandha

     

    I've seen many of the documents above and have been able to use the API,  just not to add a column.  That particular API command appears to be missing or is not obvious to me in the above docs. 

     

    I am able to make minor edits to the documents via the automation API.  I've been able to get authentication and basic usage patterns working, such as changing cell values.      I have not been able to add a column.  If I try to upload the entire spreadsheet via replace,  it is too large for the API and I get an error.   

     

      I know that it is possible to just add a column, because the web interface can do it. The web interface however does not use the automation API that is publicly documented (as far as I can see).  It appears to use a google protocol buffers based protocol via HTTP POST.   I have not gone through the effort to try to RE that protocol, and even if I do,  there is a very good possibility that the automation API won't handle it. 

     

    AI's such as out internal AI, AgentForce and  others are not able to provide a working answer.  

     

    Do you have any simple formulaic example of an invocation that will add a column with a name "NewColumn"?   This would be very helpful. 

0/9000