use of com.google.api.services.sheets.v4.model.AppendCellsRequest in project OpenRefine by OpenRefine.
the class SpreadsheetSerializer method prepareBatch.
protected List<Request> prepareBatch(List<RowData> rows) {
List<Request> requests = new ArrayList<>();
// If this row is wider than our sheet, add columns to the sheet
int columns = rows.get(0).getValues().size();
if (columns > maxColumns) {
AppendDimensionRequest adr = new AppendDimensionRequest();
adr.setDimension("COLUMNS");
adr.setLength(columns - maxColumns);
maxColumns = columns;
Request req = new Request();
req.setAppendDimension(adr);
requests.add(req);
}
AppendCellsRequest acr = new AppendCellsRequest();
acr.setFields("*");
acr.setSheetId(0);
acr.setRows(rows);
Request request = new Request();
request.setAppendCells(acr);
requests.add(request);
return requests;
}
Aggregations