Smartsheet Python API to create a link from one sheet to another.
Answers
-
Hi everybody,
I am using Smartsheet-Python-SDK v3.02. I am trying to use the Smartsheet Python API to create a link from one sheet to another. I am using the technique outlined in this article as well as what's documented in the stackoverflow this article:
https://stackoverflow.com/questions/75923260/creating-cell-links-with-smartsheet-api-python-sdk
My code runs, gives a return code of 0 and indicates success, but the link is NOT created.
I have quadruple checked the parameters that are are used in the routine (to_sheet, to_row, to_column, from_sheet, from_row, from_column).
Some other points of investigation:
- I have update access rights to both the source and target sheets in Smartsheet.
- I've cleared the target cell (not sure if that matters)
The most recent output ("results") is:
result = {"data":
[{"cells": [{"columnId": 352864357535620}, {"columnId": 4856463984906116}, {"columnId": 2604664171220868}, {"columnId": 7108263798591364}, {"columnId": 1478764264378244}, {"columnId": 5982363891748740}, {"columnId": 3730564078063492}, {"columnId": 8234163705433988}, {"columnId": 915814310956932}, {"columnId": 5419413938327428}, {"columnId": 3167614124642180}, {"columnId": 7671213752012676}, {"columnId": 2041714217799556}, {"columnId": 6545313845170052}, {"columnId": 4293514031484804}, {"columnId": 8797113658855300}],
"createdAt": "2024-03-25T19:21:01+00:00Z", "expanded": true, "id": 3624763450888068, "locked": false, "lockedForUser": false, "modifiedAt": "2024-03-26T22:01:51+00:00Z", "parentId": 4062364790067076, "rowNumber": 84, "siblingId": 174491674251140}], "message": "SUCCESS",
"result":
[{"cells": [{"columnId": 352864357535620}, {"columnId": 4856463984906116}, {"columnId": 2604664171220868}, {"columnId": 7108263798591364}, {"columnId": 1478764264378244}, {"columnId": 5982363891748740}, {"columnId": 3730564078063492}, {"columnId": 8234163705433988}, {"columnId": 915814310956932}, {"columnId": 5419413938327428}, {"columnId": 3167614124642180}, {"columnId": 7671213752012676}, {"columnId": 2041714217799556}, {"columnId": 6545313845170052}, {"columnId": 4293514031484804}, {"columnId": 8797113658855300}], "createdAt": "2024-03-25T19:21:01+00:00Z", "expanded": true, "id": 3624763450888068, "locked": false, "lockedForUser": false, "modifiedAt": "2024-03-26T22:01:51+00:00Z", "parentId": 4062364790067076, "rowNumber": 84, "siblingId": 174491674251140}], "resultCode": 0, "version": 70}
Note that I ran the routine today, but the date stamp is old and was not changed to today's date .
I've spent many hours investigating this issue. I doubt it's a SS bug since the established technique seems to be working for other folks.
If you could please help me resolve it I would be ever so grateful!
Thank you.
-
-
See attached Word doc. Is this the output you need?
Thank you again for your help. I am stumped on this one.
-
My relevant code is attached.
Thank you again.
-
Seems like the column id you are trying to update is incorrect and does not exist in the 'to' sheet. It looks like you are getting that column id from the 'From' sheet
-
Ah this was a tricky one!
To get the column numbers, I used:
sheet = smart.Sheets.get_columns(from_sheetId, include_all=True).to_dict()
data_list = sheet["data"] # "id" = columnId.
Then later in the code, to automate the column selection in my logic, I used:
download_sheet = smart.Sheets.get_sheet(to_sheetId).to_dict()
But then I missed a step. I needed to add:
data_list = download_sheet["columns"] # *** Fixed!!!
So when I referred to "data_list" at this point in the code it was referring to the first use (above) of that variable and not the second one where it's reset.
Thank you for helping me find the mistake in my code. Your feedback gave me the right clues to find the issue.
I also really appreciate that you replied to my ticket pretty quickly!
Have a great weekend and a Happy Easter!
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 439 Global Discussions
- 138 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives