0

Is it possible to collect all the sheet ids of sheets stored in a folder? I am trying to make a program that is able to update the names of sheets based off of a word in a sheet cell, I have the code already made for that here:

#this section gets the value of a specific cell for the document renaming
row = ss_client.Sheets.get_row(sheetID, rowID)
cell = row.get_column(columnID)
cellValue = cell.value + ' Folder' # This will be changed based on the type of item
# cell.value is equal to the project name

I was wondering if anyone had some input on this, I was playing around with it and an Idea I had was to use an array to store the sheet ids, and then updating the sheet names with the array that I created.

tl;dr I have a script that creates a newly copied folder and want to get a list of all the sheet ids in that new folder

adamcoolcat
  • 105
  • 7

1 Answers1

2

If you call GET /folder you should get an array of sheets that contain the sheet ids, like this:

{
  "id": 7116448184199044,
  "name": "Projects",
  "permalink": "https://app.smartsheet.com/b/home?lx=B0_lvAtnWygeMrWr4Rfoa",
  "sheets": [
    {
      "id": 4509918431602564,
      "name": "Project Timeline",
      "accessLevel": "OWNER",
      "permalink": "https://app.smartsheet.com/b/home?lx=uWicCItTmkbxJwpCfQ5wiwW",
      "createdAt": "2015-06-05T20:05:29Z",
      "modifiedAt": "2015-06-05T20:05:43Z"
    }
  ]
}
stmcallister
  • 1,682
  • 1
  • 12
  • 21
  • When I try to get the id array from the get.folder() call (by using folder = folder.sheets.id), I get the answer: "AttributeError: 'TypedList' object has no attribute 'id'" I'm not sure what function to call in python to get the array of ids in the folder. – adamcoolcat Aug 02 '18 at 13:05
  • Looks like you created a new question for this, so I posted the answer there: https://stackoverflow.com/a/51659870/413234 – stmcallister Aug 02 '18 at 18:12