Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Smartsheet smartsheet = new SmartsheetBuilder().setAccessToken("[My Access Token]").build();
- sheetId = 00000000000000; // My Sheet ID
- Sheet sheet = smartsheet.sheetResources().getSheet(sheetId, null, null, null, null, null, null, null);
- List<Row> rows = sheet.getRows();
- Row row = new Row();
- row.setId(rows.get(2).getId()); // Updating the second row of the sheet.
- row.setIndent(1);
- row.setParentId(rows.get(1).getId()); // Set the parent as the row immediately above (which is not indented).
- Cell cell = new Cell();
- cell.setColumnId(rows.get(1).getCells().get(0).getColumnId());
- cell.setValue("Test");
- List<Cell> cells = Arrays.asList(cell);
- row.setCells(cells);
- rows = Arrays.asList(row);
- smartsheet.sheetResources().rowResources().updateRows(sheetId, rows);
- Exception in thread "main" com.smartsheet.api.InvalidRequestException: Invalid row location.
- at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
- at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
- at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
- at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
- at com.smartsheet.api.internal.AbstractResources$ErrorCode.getException(AbstractResources.java:147)
- at com.smartsheet.api.internal.AbstractResources.handleError(AbstractResources.java:894)
- at com.smartsheet.api.internal.AbstractResources.putAndReceiveList(AbstractResources.java:745)
- at com.smartsheet.api.internal.SheetRowResourcesImpl.updateRows(SheetRowResourcesImpl.java:252)
- at Test3.main(Test3.java:67)
Add Comment
Please, Sign In to add comment