i've a problem with 'public spreadsheets'. The thing is that i tried to
read cells of a Spreadsheet with permissions: "Public for anyone - read
only". I use the code of James Moore
(http://blog.restphone.com/2011/05/very-simple-google-spreadsheet-code.html).
The code of James works well, but the problem is, when i try create a file
and give permissions and then use the code of James, doesn't work. Only
work if i go to the spreadsheet (manually) and set "File->Publish to the
Web" then the code works. But i need to add this "Publish to the Web" via
Java code because i created a spreadsheet via java code and i can give
permission of "public for anyone" but i can't give "publish to the web".
Some code:
File file = new File();
file.setTitle(fileName);
file.setDescription("Default Description");
file.setMimeType(SPREADSHEET_CREATE_FILE); // For Spreadsheet
file.setShared(true);
file = GoogleDriveService.files().insert(file).execute();
Permission newPermission = new Permission();
newPermission.setValue(value);
newPermission.setType(type);
newPermission.setRole(role);
newPermission.getWithLink();
GoogleDriveService.permissions().insert(fileId,
newPermission).execute();
Thanks.
Pablo Reyes
--
You received this message because you are subscribed to the Google Groups
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.