Python SDK - projectSettings - nonWorkingDays

So me and the Python SDK is having a bit of a disagreement about updating projectSettings of a sheet and the SDK just gives me an error (the audacity!).

Reading the API docs (https://smartsheet-platform.github.io/api-docs/?python#projectsettings-object) my interpretation is this:

nonWorkingDays: "...The format for the timestamp array must be an array of strings that are valid ISO-8601 dates ('YYYY-MM-DD')."

workingDays: "...Valid values must be an array of strings of days of the week..."

is that both wants a list of strings when using the SDK.

So I tried with this:

updated_sheet = smartsheet_client.Sheets.update_sheet( SMARTSHEET_ID, smartsheet.models.Sheet({ 'project_settings': smartsheet.models.ProjectSettings({ 'working_days': ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY'] }) }) )

Works flawlessly and exactly how I would expect it. Strengthend by this I tried with this:

updated_sheet = smartsheet_client.Sheets.update_sheet( SMARTSHEET_ID, smartsheet.models.Sheet({ 'project_settings': smartsheet.models.ProjectSettings({ 'non_working_days': ['2020-10-30', '2020-12-23'] }) }) )

But instead of another success I get greated by this error:

{"response": {"statusCode": 400, "reason": "Bad Request", "content": {"errorCode": 1008, "message": "Unable to parse request. The following error occurred: Field \"null\" was of unexpected type.", "refId": "ozjgdl26up89"}}} Traceback (most recent call last): File "smartsheet_holidays.py", line 50, in  'non_working_days': ['2020-10-30', '2020-12-23'] File "/mnt/c/Users/sni/Documents/TempDev/PythonHolidays3.6/lib/python3.6/site-packages/smartsheet/sheets.py", line 1110, in update_sheet response = self._base.request(prepped_request, expected, _op) File "/mnt/c/Users/sni/Documents/TempDev/PythonHolidays3.6/lib/python3.6/site-packages/smartsheet/smartsheet.py", line 250, in request raise the_ex(native, str(native.result.code) + ': ' + native.result.message) smartsheet.exceptions.ApiError: {"result": {"code": 1008, "errorCode": 1008, "message": "Unable to parse request. The following error occurred: Field \"null\" was of unexpected type.", "name": "ApiError", "recommendation": "Do not retry without fixing the problem. ", "refId": "ozjgdl26up89", "shouldRetry": false, "statusCode": 400}}

Either I'm too stupid too understand the API docs, too bad at Python or something else is going on. All scenarios are entirly plausible but regardless I'm stuck and very much appreciate som pointers on where I'm going wrong.

Best Answer

Answers

@Neil Watson<\/a> You should be able to use the LOWER function for evaluation but still output the version that includes caps.<\/p>

=IFERROR(INDEX(DISTINCT(LOWER(<\/strong>COLLECT(.....................))<\/strong>), 1), \"//www.santa-greenland.com/community/discussion/71758/\")<\/p>


<\/p>

I haven't tested it yet, but I feel like it should work.<\/p>"},{"commentID":386435,"body":"

Right. There are already a number of posts here in the community detailing how to pull a distinct or unique list from another sheet via formula. It usually involves the formula above without the LOWER function. The number 1 would output the first distinct value. Changing that to a 2 will output the second distinct value, so on and so forth. I usually use a helper column with the numbers manually entered so I can apply it as a column formula.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":369,"urlcode":"bridge-by-smartsheet","name":"Bridge"}]},{"discussionID":107674,"type":"question","name":"API PUT and Body help for Cell link from a cell in sheet \"a\" to sheet \"b\"","excerpt":"I am having trouble linking a cell from sheet a to b. I am new to using API and possibly just getting the call wrong? or the body. Any help would be appreciated. PUT: https:\/\/api.smartsheet.com\/2.0\/sheets\/4098048888098692\/rows\/1370574824361860\/cells\/259016080 Body: { \"cells\": [ { \"linkinFromCell\": {…","snippet":"I am having trouble linking a cell from sheet a to b. I am new to using API and possibly just getting the call wrong? or the body. Any help would be appreciated. PUT:…","categoryID":320,"dateInserted":"2023-07-17T16:23:24+00:00","dateUpdated":"2023-07-18T10:24:44+00:00","dateLastComment":"2023-07-18T16:45:05+00:00","insertUserID":135530,"insertUser":{"userID":135530,"name":"Carlo Rodriguez","url":"https:\/\/community.smartsheet.com\/profile\/Carlo%20Rodriguez","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-21T15:50:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":91566,"lastUserID":135530,"lastUser":{"userID":135530,"name":"Carlo Rodriguez","url":"https:\/\/community.smartsheet.com\/profile\/Carlo%20Rodriguez","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-21T15:50:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":51,"score":null,"hot":3379310909,"url":"https:\/\/community.smartsheet.com\/discussion\/107674\/api-put-and-body-help-for-cell-link-from-a-cell-in-sheet-a-to-sheet-b","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/107674\/api-put-and-body-help-for-cell-link-from-a-cell-in-sheet-a-to-sheet-b","format":"Rich","tagIDs":[472,563],"lastPost":{"discussionID":107674,"commentID":385785,"name":"Re: API PUT and Body help for Cell link from a cell in sheet \"a\" to sheet \"b\"","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/385785#Comment_385785","dateInserted":"2023-07-18T16:45:05+00:00","insertUserID":135530,"insertUser":{"userID":135530,"name":"Carlo Rodriguez","url":"https:\/\/community.smartsheet.com\/profile\/Carlo%20Rodriguez","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-21T15:50:31+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-07-18T16:45:08+00:00","dateAnswered":"2023-07-18T11:38:00+00:00","acceptedAnswers":[{"commentID":385713,"body":"

Hey @Carlo Rodriguez<\/a> <\/p>

This is how I've successfully added a cell-link using the API:<\/p>


<\/p>

PUT (with the destination sheet data): <\/p>

https:\/\/api.smartsheet.com\/2.0\/sheets\/XXXX\/rows\/X<\/a>XXX<\/p>


<\/p>

Body (with the source sheet data, but the initial ColumnID from the destination sheet to show where to put the link):<\/p>

{\n  \"cells\": [\n    {\n      \"columnId\": 11111,\n            \"value\": null,\n            \"linkInFromCell\": {\n                \"sheetId\": 22222,\n                \"rowId\": 33333,\n                \"columnId\": 44444\n            }\n    }\n     ]\n}\n<\/pre>


<\/p>

Let me know if this works for you!<\/p>

Cheers,<\/p>

Genevieve<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":472,"urlcode":"cell-linking","name":"Cell linking"},{"tagID":563,"urlcode":"api","name":"API"}]},{"discussionID":107600,"type":"question","name":"Drop Downs - Can a Response Trigger the Cell to Change Color?","excerpt":"Hello, Is there a functionality whereby a cell changes color when someone chooses a drop-down choice? For example, my drop-down choices are: Paid Overdue Sent Is there a way to trigger the cell to change to Green if 'Paid' is chosen, Red if 'overdue' is chosen, and Blue if 'Sent' is chosen? I know there are rules I can…","snippet":"Hello, Is there a functionality whereby a cell changes color when someone chooses a drop-down choice? For example, my drop-down choices are: Paid Overdue Sent Is there a way to…","categoryID":320,"dateInserted":"2023-07-13T22:02:54+00:00","dateUpdated":"2023-07-13T22:14:14+00:00","dateLastComment":"2023-07-13T22:25:34+00:00","insertUserID":163335,"insertUser":{"userID":163335,"name":"Stef Seaker","title":"Director of Operations","url":"https:\/\/community.smartsheet.com\/profile\/Stef%20Seaker","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-07-28T15:11:06+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":163335,"lastUserID":161714,"lastUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-07-28T18:51:13+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":1,"countViews":56,"score":null,"hot":3378573508,"url":"https:\/\/community.smartsheet.com\/discussion\/107600\/drop-downs-can-a-response-trigger-the-cell-to-change-color","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/107600\/drop-downs-can-a-response-trigger-the-cell-to-change-color","format":"Rich","lastPost":{"discussionID":107600,"commentID":385173,"name":"Re: Drop Downs - Can a Response Trigger the Cell to Change Color?","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/385173#Comment_385173","dateInserted":"2023-07-13T22:25:34+00:00","insertUserID":161714,"insertUser":{"userID":161714,"name":"Carson Penticuff","url":"https:\/\/community.smartsheet.com\/profile\/Carson%20Penticuff","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/B0Q390EZX8XK\/nBGT0U1689CN6.jpg","dateLastActive":"2023-07-28T18:51:13+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-07-26T22:11:46+00:00","dateAnswered":"2023-07-13T22:25:34+00:00","acceptedAnswers":[{"commentID":385173,"body":"

Here is the basic process to conditionally format the background of a cell based on its contents. In this scenario, you would need to setup three format options, one for each color\/selection.<\/p>

\n
\n \n \"CF<\/img><\/a>\n <\/div>\n<\/div>\n
\n
\n \n \"CF<\/img><\/a>\n <\/div>\n<\/div>\n
\n
\n \n \"CF<\/img><\/a>\n <\/div>\n<\/div>\n
\n
\n \n \"CF<\/img><\/a>\n <\/div>\n<\/div>\n
\n
\n \n \"CF<\/img><\/a>\n <\/div>\n<\/div>\n


<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=320&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":207,"limit":3},"title":"Trending in API & Developers","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

Trending in API & Developers