Is it possible to copy spreadsheets with gdata API or worksheets from one spreadsheet to other? For now i copy all cells from one worksheet to another. One cell per request. It is too slow. I read about "cell batch processing" and write this code:
src_key = 'rFQqEnFWuR6qoU2HEfdVuTw'; dst_key = 'rPCVJ80MHt7K2EVlXNqytLQ'
sheetcl = gdata.spreadsheet.service.SpreadsheetsService('[email protected]','p')
dcs = gdata.docs.service.DocsService('[email protected]', 'p')
src_worksheets = sheetcl.GetWorksheetsFeed(src_key)
dst_worksheets = sheetcl.GetWorksheetsFeed(dst_key)
for src_worksheet, dst_worksheet in zip(src_worksheets.entry, dst_worksheets.entry):
sheet_id = src_worksheet.id.text.split('/')[-1]
dst_sheet_id = dst_worksheet.id.text.split('/')[-1]
cells_feed = sheetcl.GetCellsFeed(src_key, sheet_id)
dst_cells_feed = sheetcl.GetCellsFeed(dst_key, dst_sheet_id)
for cell in cells_feed.entry:
dst_cells_feed.AddInsert(cell)
sheetcl.ExecuteBatch(dst_cells_feed, dst_cells_feed.GetBatchLink().href)
But it doesn't work. As I suppose reason is that each cell in inner loop has its id which consist of spreadsheet_id:
>>> cell.id.text
'http://spreadsheets.google.com/feeds/cells/rFQqEnFWuR6qoU2HEfdVuTw/default/private/full/R1C1'
>>>