Export Google Calendar to Google Spreadsheets with gcal-exporter in Java. All the methods in Gsheet.java and Gspread.java are reusable.
- Java 1.8 or greater
- Gradle 4.10 or greater
$ gradle fatJar
$ java -jar ./build/libs/gcal-exporter-1.2.jar
After entering the start date and end date of the calendar events to export, it will open a new window or tab in the default browser window for the authorization.
Gcal gcal = new Gcal(timeStart, timeEnd);
List<CalendarListEntry> calendars = gcal.getCalendars();
// Print name, id, and time zone of calendars
gcal.printCalendarInfo();
// Print all the events in all calendars
gcal.printAllEvents();
// Get all the events from a calendar
List<List<String>> data = gcal.getDataFromCalendar(CalendarListEntry calendar);
// Get a number of events from a calendar
List<List<String>> data = gcal.getDataFromCalendar(CalendarListEntry calendar, Integer numberOfEvents);
Gsheet gsheet = new Gsheet();
// Create a spreadsheet
spreadsheet = gsheet.createNewSpreadsheet(String spreadsheetTitle);
// Find a spreadsheet
spreadsheet = gsheet.getSpreadsheet(String spreadsheetId);
// Print sheet name and sheet id
gsheet.printSheetInfo(Spreadsheet spreadsheet);
// Print data in a sheet
gsheet.printSheetData(Spreadsheet spreadsheet, String sheetTitle);
gsheet.updateSpreadsheetTitle(Spreadsheet spreadsheet, String spreadsheetTitle);
// Add a sheet
newSheet = gsheet.addNewSheet(Spreadsheet spreadsheet, String sheetTitle);
// Find a sheet
sheet = gsheet.findSheet(Spreadsheet spreadsheet, String sheetTitle);
gsheet.deleteSheet(Spreadsheet spreadsheet, Integer sheetId);
gsheet.clearSheet(Spreadsheet spreadsheet, Sheet sheet);
// Append data to the default sheet created with the spreadsheet
gsheet.appendRowDtata(Spreadsheet spreadsheet, List<String> rowData);
// Append data to a new sheet
gsheet.appendRowDtata(Spreadsheet spreadsheet, Sheet sheet, List<String> rowData);
// Import data to the default sheet
gsheet.importData(Spreadsheet spreadsheet, List<List<String>> data);
// Import data to a new sheet
gsheet.importData(Spreadsheet spreadsheet, Sheet sheet, List<List<String>> data);
// Resize all columns based on the contents of the cells in the default sheet
gsheet.resizeColumns(Spreadsheet spreadsheet);
// Resize all columns based on the contents of the cells in a given sheet
gsheet.resizeColumns(Spreadsheet spreadsheet, Sheet sheet);
// Sort data in rows based on a sort order of a column in the default sheet
gsheet.sortByColumn(Spreadsheet spreadsheet, Integer columnIndex, Integer startRowIndex, String sortSpec);
// Sort data in rows based on a sort order of a column in the given sheet
gsheet.sortByColumn(Spreadsheet spreadsheet, Sheet sheet, Integer columnIndex, Integer startRowIndex, String sortSpec);