1

I was attempting to copy a sheet with the python API, but every time I do so, it only includes the formatting (column names and number of rows), but I would like it to include the data. Is there any way I can do this? I have tried it with a template as well and the same thing happens it creates a new sheet but it doesn't have any of the data.

Edited code after the question was answered:

inc_list = ['data'] # you can add other parameters here, separated by a comma
response = ss_client.Sheets.copy_sheet(
sheetID,                               # sheet_id
ss_client.models.ContainerDestination({
'destination_type': 'folder',               # folder, workspace, or home
'destination_id': folderID,         # folder_id
'new_name': cellValue,
}),
include=inc_list
)
adamcoolcat
  • 105
  • 7

1 Answers1

1

There is an include parameter that needs to be added.

For example,

    inc_list = ["data"]
    sht = SmSh.Sheets.copy_sheet(src_sheet_id,
                                 SmSh.models.ContainerDestination({
                                 "destination_type": "folder",
                                 "destination_id": dest_id,
                                 "new_name": new_sheet_name}),
                                 include=inc_list
                                 )

Note that dest_id and new_sheet_name are also arguments set above this code snippet and not shown.

A complete list of the include parameters is shown in the SDK docs: https://smartsheet-platform.github.io/api-docs/?python#copy-sheet

Craig

J. Craig Williams
  • 380
  • 1
  • 2
  • 18
  • 1
    It worked! Thanks so much, I appreciate it. I knew that I needed to call to include the data (and other parameters), I just wasn't sure how in python. I don't think this was referenced in the python section of the document, so that's why I posted here. – adamcoolcat Jul 23 '18 at 18:24