Hi Claudio,
I hope that this helps!
This are the steps:
1. *Copy spreadsheet template to root*
private String sendPostCopyRequest(String authorizationToken, String
resourceID, String title, int noRetries) throws IOException{
/*
resourceId = resource id for the template that i want to copy
title = the title of the new file created
*/
String urlStr = "https://docs.google.com/feeds/default/private/full";
URL url = new URL(urlStr);
HttpURLConnection copyHttpUrlConn = (HttpURLConnection)
url.openConnection();
copyHttpUrlConn.setDoOutput(true);
copyHttpUrlConn.setRequestMethod("POST");
String outputString = "<?xml version='1.0' encoding='UTF-8'?>" +
"<entry xmlns=\"http://www.w3.org/2005/Atom\"> " +
"<id>https://docs.google.com/feeds/default/private/full/" + resourceID
+"</id>" +
" <title>" + title + "</title></entry>";
copyHttpUrlConn.setRequestProperty("GData-Version", "3.0");
copyHttpUrlConn.setRequestProperty("Content-Type","application/atom+xml");
copyHttpUrlConn.setRequestProperty("Content-Length", outputString.length()
+ "");
copyHttpUrlConn.setRequestProperty("Authorization", "GoogleLogin auth=" +
authorizationToken);
OutputStream outputStream = copyHttpUrlConn.getOutputStream();
outputStream.write(outputString.getBytes());
copyHttpUrlConn.getResponseCode();
return readIdFromResponse(copyHttpUrlConn.getInputStream());
}
2. *I update some cells using this method:*
public boolean setCellValue(SpreadsheetService spreadSheetService,
SpreadsheetEntry entry, int worksheetNumber, String position, String value)
throws IOException, ServiceException {
List<WorksheetEntry> worksheets = entry.getWorksheets();
WorksheetEntry worksheet = worksheets.get(worksheetNumber);
URL cellFeedUrl = worksheet.getCellFeedUrl();
CellQuery query = new CellQuery(cellFeedUrl);
query.setReturnEmpty(true);
query.setRange(position);
CellFeed cellFeed = spreadSheetService.query(query, CellFeed.class);
CellEntry cell = cellFeed.getEntries().get(0);
cell.changeInputValueLocal(value);
cell.update();
return true;
}
3. *I move the created file to a new folder (collection)*
*
*
public DocumentListEntry moveSpreadSheet(DocsService docsService, String
entryId, String destinationFolderDocId)
throws MalformedURLException, IOException, ServiceException {
DocumentListEntry newEntry = null;
newEntry = new com.google.gdata.data.docs.SpreadsheetEntry();
newEntry.setId(entryId);
String destFolderUri =
"https://docs.google.com/feeds/default/private/full/folder%3A"+
destinationFolderDocId + "/contents";
return docsService.insert(new URL(destFolderUri), newEntry);
}
On Tuesday, March 27, 2012 4:07:12 AM UTC+3, Claudio Cherubino wrote:
>
> Hi Alexandru,
>
> Can you provide us with the code to reproduce this issue?
> Thanks
>
> Claudio
>
> On Mon, Mar 26, 2012 at 1:16 PM, Alexandru Farcaş <
> [email protected]> wrote:
>
>> Any update on this issue?
>> The problem still persist...
>>
>> On Friday, March 16, 2012 6:30:39 PM UTC+2, Alexandru Farcaş wrote:
>>>
>>> Can I give you the account to test this searches?
>>
>>
>