@Test public void testUpdateValues() throws IOException { String spreadsheetId = this.createTestSpreadsheet(); List<List<Object>> values = Arrays.asList( Arrays.asList("A", "B"), Arrays.asList("C", "D")); UpdateValuesResponse result = this.snippets.updateValues(spreadsheetId, "A1:B2", "USER_ENTERED", values); assertEquals(2, result.getUpdatedRows().intValue()); assertEquals(2, result.getUpdatedColumns().intValue()); assertEquals(4, result.getUpdatedCells().intValue()); }
public UpdateValuesResponse updateValues(String spreadsheetId, String range, String valueInputOption, List<List<Object>> _values) throws IOException { Sheets service = this.service; List<List<Object>> values = Arrays.asList( Arrays.asList( ) ); values = _values; ValueRange body = new ValueRange() .setValues(values); UpdateValuesResponse result = service.spreadsheets().values().update(spreadsheetId, range, body) .setValueInputOption(valueInputOption) .execute(); System.out.printf("%d cells updated.", result.getUpdatedCells()); return result; }
SpreadsheetSnippets { public UpdateValuesResponse updateValues(String spreadsheetId, String range, String valueInputOption, List<List<Object>> _values) throws IOException { Sheets service = this.service; List<List<Object>> values = Arrays.asList( Arrays.asList( ) ); values = _values; ValueRange body = new ValueRange() .setValues(values); UpdateValuesResponse result = service.spreadsheets().values().update(spreadsheetId, range, body) .setValueInputOption(valueInputOption) .execute(); System.out.printf("%d cells updated.", result.getUpdatedCells()); return result; } }
SpreadsheetSnippets { public UpdateValuesResponse updateValues(String spreadsheetId, String range, String valueInputOption, List<List<Object>> _values) throws IOException { Sheets service = this.service; List<List<Object>> values = Arrays.asList( Arrays.asList( ) ); values = _values; ValueRange body = new ValueRange() .setValues(values); UpdateValuesResponse result = service.spreadsheets().values().update(spreadsheetId, range, body) .setValueInputOption(valueInputOption) .execute(); System.out.printf("%d cells updated.", result.getUpdatedCells()); return result; } SpreadsheetSnippets(Sheets service); }
SpreadsheetSnippets { public UpdateValuesResponse updateValues(String spreadsheetId, String range, String valueInputOption, List<List<Object>> _values) throws IOException { Sheets service = this.service; List<List<Object>> values = Arrays.asList( Arrays.asList( ) ); values = _values; ValueRange body = new ValueRange() .setValues(values); UpdateValuesResponse result = service.spreadsheets().values().update(spreadsheetId, range, body) .setValueInputOption(valueInputOption) .execute(); System.out.printf("%d cells updated.", result.getUpdatedCells()); return result; } SpreadsheetSnippets(Sheets service); String create(String title); BatchUpdateSpreadsheetResponse batchUpdate(String spreadsheetId, String title,
                                                      String find, String replacement); ValueRange getValues(String spreadsheetId, String range); BatchGetValuesResponse batchGetValues(String spreadsheetId, List<String> _ranges); UpdateValuesResponse updateValues(String spreadsheetId, String range,
                                             String valueInputOption, List<List<Object>> _values); BatchUpdateValuesResponse batchUpdateValues(String spreadsheetId, String range,
                                                       String valueInputOption,
                                                       List<List<Object>> _values); AppendValuesResponse appendValues(String spreadsheetId, String range,
                                             String valueInputOption, List<List<Object>> _values); BatchUpdateSpreadsheetResponse pivotTables(String spreadsheetId); BatchUpdateSpreadsheetResponse conditionalFormat(String spreadsheetId); }
SpreadsheetSnippets { public UpdateValuesResponse updateValues(String spreadsheetId, String range, String valueInputOption, List<List<Object>> _values) throws IOException { Sheets service = this.service; List<List<Object>> values = Arrays.asList( Arrays.asList( ) ); values = _values; ValueRange body = new ValueRange() .setValues(values); UpdateValuesResponse result = service.spreadsheets().values().update(spreadsheetId, range, body) .setValueInputOption(valueInputOption) .execute(); System.out.printf("%d cells updated.", result.getUpdatedCells()); return result; } SpreadsheetSnippets(Sheets service); String create(String title); BatchUpdateSpreadsheetResponse batchUpdate(String spreadsheetId, String title,
                                                      String find, String replacement); ValueRange getValues(String spreadsheetId, String range); BatchGetValuesResponse batchGetValues(String spreadsheetId, List<String> _ranges); UpdateValuesResponse updateValues(String spreadsheetId, String range,
                                             String valueInputOption, List<List<Object>> _values); BatchUpdateValuesResponse batchUpdateValues(String spreadsheetId, String range,
                                                       String valueInputOption,
                                                       List<List<Object>> _values); AppendValuesResponse appendValues(String spreadsheetId, String range,
                                             String valueInputOption, List<List<Object>> _values); BatchUpdateSpreadsheetResponse pivotTables(String spreadsheetId); BatchUpdateSpreadsheetResponse conditionalFormat(String spreadsheetId);  }