Guest User

Untitled

a guest
Feb 25th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. Smartsheet smartsheet = new SmartsheetBuilder().setAccessToken("[My Access Token]").build();
  2. sheetId = 00000000000000; // My Sheet ID
  3. Sheet sheet = smartsheet.sheetResources().getSheet(sheetId, null, null, null, null, null, null, null);
  4. List<Row> rows = sheet.getRows();
  5. Row row = new Row();
  6. row.setId(rows.get(2).getId()); // Updating the second row of the sheet.
  7. row.setIndent(1);
  8. row.setParentId(rows.get(1).getId()); // Set the parent as the row immediately above (which is not indented).
  9. Cell cell = new Cell();
  10. cell.setColumnId(rows.get(1).getCells().get(0).getColumnId());
  11. cell.setValue("Test");
  12. List<Cell> cells = Arrays.asList(cell);
  13. row.setCells(cells);
  14. rows = Arrays.asList(row);
  15. smartsheet.sheetResources().rowResources().updateRows(sheetId, rows);
  16.  
  17. Exception in thread "main" com.smartsheet.api.InvalidRequestException: Invalid row location.
  18. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  19. at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  20. at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  21. at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  22. at com.smartsheet.api.internal.AbstractResources$ErrorCode.getException(AbstractResources.java:147)
  23. at com.smartsheet.api.internal.AbstractResources.handleError(AbstractResources.java:894)
  24. at com.smartsheet.api.internal.AbstractResources.putAndReceiveList(AbstractResources.java:745)
  25. at com.smartsheet.api.internal.SheetRowResourcesImpl.updateRows(SheetRowResourcesImpl.java:252)
  26. at Test3.main(Test3.java:67)
Add Comment
Please, Sign In to add comment