public class GoogleSheetsHelper
extends java.lang.Object
implements java.lang.AutoCloseable
This relies on the old GData API. Docs at https://developers.google.com/google-apps/spreadsheets/.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SHEETS_SCOPE |
| Constructor and Description |
|---|
GoogleSheetsHelper(GoogleApiHelper apiHelper,
java.lang.String service) |
GoogleSheetsHelper(java.lang.String userId,
java.lang.String privateKey,
java.lang.String service) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
exportToTsv(java.lang.String fileId,
java.nio.file.Path tsvFile)
Exports sheet with the specified ID to TSV.
|
void |
exportToTsv(java.lang.String fileId,
java.nio.file.Path tsvFile,
int sheetNumber)
Exports sheet with the specified ID to TSV.
|
void |
exportToTsv(java.lang.String fileId,
java.nio.file.Path tsvFile,
java.lang.String sheetName)
Exports sheet with the specified ID to TSV.
|
void |
exportToTsv(java.net.URL url,
java.nio.file.Path tsvFile)
Exports the default sheet with the specified ID to TSV.
|
void |
exportToTsv(java.net.URL url,
java.nio.file.Path tsvFile,
int sheetNumber)
Exports the specified sheet with the specified ID to TSV.
|
void |
exportToTsv(java.net.URL url,
java.nio.file.Path tsvFile,
java.lang.String sheetName)
Exports the specified sheet with the specified ID to TSV.
|
com.google.gdata.client.spreadsheet.SpreadsheetService |
getService() |
java.util.List<com.google.gdata.data.spreadsheet.SpreadsheetEntry> |
getSheets()
Gets a list of all sheets for user.
|
public static final java.lang.String SHEETS_SCOPE
public GoogleSheetsHelper(@Nonnull
java.lang.String userId,
@Nonnull
java.lang.String privateKey,
@Nonnull
java.lang.String service)
throws java.io.IOException,
java.security.GeneralSecurityException
java.io.IOExceptionjava.security.GeneralSecurityExceptionpublic GoogleSheetsHelper(@Nonnull
GoogleApiHelper apiHelper,
@Nonnull
java.lang.String service)
throws java.io.IOException,
java.security.GeneralSecurityException
java.io.IOExceptionjava.security.GeneralSecurityExceptionpublic void close()
close in interface java.lang.AutoCloseablepublic com.google.gdata.client.spreadsheet.SpreadsheetService getService()
public java.util.List<com.google.gdata.data.spreadsheet.SpreadsheetEntry> getSheets()
throws java.io.IOException,
com.google.gdata.util.ServiceException
java.io.IOExceptioncom.google.gdata.util.ServiceExceptionpublic void exportToTsv(java.lang.String fileId,
java.nio.file.Path tsvFile)
throws java.io.IOException,
com.google.gdata.util.ServiceException
fileId - a file Id from Google Drivejava.io.IOExceptioncom.google.gdata.util.ServiceExceptionpublic void exportToTsv(java.net.URL url,
java.nio.file.Path tsvFile)
throws java.io.IOException,
com.google.gdata.util.ServiceException
url - URL from BaseEntry.getId() ()}java.io.IOExceptioncom.google.gdata.util.ServiceExceptionpublic void exportToTsv(java.lang.String fileId,
java.nio.file.Path tsvFile,
int sheetNumber)
throws java.io.IOException,
com.google.gdata.util.ServiceException
fileId - a file Id from Google DrivesheetNumber - sheet number (starting at 0)java.io.IOExceptioncom.google.gdata.util.ServiceExceptionpublic void exportToTsv(java.net.URL url,
java.nio.file.Path tsvFile,
int sheetNumber)
throws java.io.IOException,
com.google.gdata.util.ServiceException
url - URL from BaseEntry.getId() ()}sheetNumber - sheet number (starting at 0)java.io.IOExceptioncom.google.gdata.util.ServiceExceptionpublic void exportToTsv(java.lang.String fileId,
java.nio.file.Path tsvFile,
java.lang.String sheetName)
throws java.io.IOException,
com.google.gdata.util.ServiceException
fileId - a file Id from Google DrivesheetName - sheet namejava.io.IOExceptioncom.google.gdata.util.ServiceExceptionpublic void exportToTsv(java.net.URL url,
java.nio.file.Path tsvFile,
java.lang.String sheetName)
throws java.io.IOException,
com.google.gdata.util.ServiceException
url - URL from BaseEntry.getId() ()}sheetName - sheet namejava.io.IOExceptioncom.google.gdata.util.ServiceException