When I create a new sheet using the smartsheet java api it is always created in the "sheets" folder under home. is it possible to move this sheet or create it in a different workspace/folder?
Below I have listed an example on how to create a sheet in a new folder as well as how to copy an existing sheet to a new folder. If you want to move a sheet to a new folder you can first copy the sheet to the new folder and then delete the original sheet.
Please note, that both the sheet id and folder id can be retrieved by right clicking on the sheet or folder inside Smartsheet and clicking properties.
String token = "YOUR_TOKEN";
Smartsheet smartsheet = new SmartsheetBuilder().setAccessToken(token).build();
// Define sheet to copy
Sheet sheet = new Sheet();
sheet.setName("New Sheet");
// Create columns for the new sheet
List<Column> columns = new ArrayList<Column>();
Column column = new Column();
column.setTitle("Column #1");
column.setPrimary(true);
column.setType(ColumnType.TEXT_NUMBER);
columns.add(column);
Column column2 = new Column();
column2.setTitle("Column #2");
column2.setType(ColumnType.TEXT_NUMBER);
columns.add(column2);
sheet.setColumns(columns);
// Define folder to put sheet in
long folderId = 907281073235844L;
// Create the new sheet and put it in the specified folder
Sheet newSheet = smartsheet.sheets().createSheetInFolder(folderId, sheet);
System.out.println(newSheet.getId());
String token = "YOUR_TOKEN";
Smartsheet smartsheet = new SmartsheetBuilder().setAccessToken(token).build();
// Define sheet to copy
Sheet sheet = new Sheet();
sheet.setFromId(7298027523204996L);
// Define folder to put sheet in
long folderId = 907281173235844L;
// copy the sheet to the specified folder
Sheet newSheet = smartsheet.sheets().createSheetInFolder(folderId, sheet);
System.out.println(newSheet.getId());
String token = "YOUR_TOKEN";
Smartsheet smartsheet = new SmartsheetBuilder().setAccessToken(token).build();
smartsheet.sheets().deleteSheet(1758379303587716L);