Tomasz
Tomasz

Reputation: 2071

How to get spreadsheets list from specific collection from Google docs in Java

I'm wondering is it possible to get list of SpreadSheets from Google Docs in Java?

URL SPREADSHEET_FEED_URL = new URL("https://spreadsheets.google.com/feeds/spreadsheets/private/full");


SpreadsheetFeed feed = service.getFeed(SPREADSHEET_FEED_URL, SpreadsheetFeed.class);
List<SpreadsheetEntry> spreadsheetEntries = feed.getEntries();

The above code gets list of all spreadsheets on an account, but I need files from specific location (collection created in Google docs)

Thanks for your help.

Upvotes: 1

Views: 1504

Answers (1)

megabyte1024
megabyte1024

Reputation: 8660

Yes, it is possible. For this purpose is necessary to use the Google Documents List API. I implemented a similar task by dong the following

  1. to traverse folders starting from the root;
  2. to find the folder location;
  3. to retrieve the folder's file list;
  4. to find the required spreadsheet and to extract its key from its URL;
  5. to iterate all spreadsheets using the Google Spreadsheets API, to extract URL keys for every spreadsheet and to compare the extracted key with the key from the p.4. If the keys are equal, the requested spreadsheet is found.

May be it is not efficient way, but it works. Here is a question which I asked and is linked with this task. The code is in C# but the logic is clear.

Upvotes: 1

Related Questions