Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

spreadsheet InsertRow questions #13

Open
carolinux opened this issue Mar 17, 2015 · 0 comments
Open

spreadsheet InsertRow questions #13

carolinux opened this issue Mar 17, 2015 · 0 comments

Comments

@carolinux
Copy link

Hello, I wanted to ask if it's possible to (a)specify where to insert row in a spreadsheet instead of just appending at the end(b) specify the format of the cells. I basically want the new cells inserted to have the same format as the cell above them.

I looked at the code here and it seems it uses the POST function here to insert a row:
https://github.com/google/gdata-python-client/blob/79d2d3c8a26662943fcbff11ec29732ad92bbf8b/src/gdata/service.py

Is it possible to insert somewhere not at the end? And also to specify the formatting? Thanks :) Apologies is posting at a wrong place, will move it if necessary.

def InsertRow(self, row_data, key, wksht_id='default'):
"""Inserts a new row with the provided data
Args:
uri: string The post uri of the list feed
row_data: dict A dictionary of column header to row data
Returns:
The inserted row
"""
new_entry = gdata.spreadsheet.SpreadsheetsList()
for k, v in row_data.iteritems():
    new_custom = gdata.spreadsheet.Custom()
    new_custom.column = k
    new_custom.text = v
    new_entry.custom[new_custom.column] = new_custom
# Generate the post URL for the worksheet which will receive the new entry.
post_url = 'https://spreadsheets.google.com/feeds/list/%s/%s/private/full'%(
key, wksht_id)
return self.Post(new_entry, post_url,
converter=gdata.spreadsheet.SpreadsheetsListFromString)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant