Table of Contents
This project was written to perform two very specific tasks using the smartsheet API.
- To poulate a dropdown list with options from a target column
- to update two co-dependent columns, such as the parts of an engine, and the engines a part can be found in.
Other features may be added later if requested, but for now it performs these two tasks
If your aim is to update a sheet or column regularly, I would recomend setting up the main.py with your column titles and converting it to an executable. in order for this to work i would recomend setting up an environment with the smartsheet-python-sdk and adding the executable to its path.
in your smartsheet environment install the smartsheet-python-sdk package by typing:
$ pip install smartsheet-python-sdk
in your command prompt
If you want to run the project as an executable, also install auto-py-to-exe, using the command:
$ pip install auto-py-to-exe
in the main.py file
set the correct name values
workspace = 'Workspace name'
dropdown_sheet = 'Dropdown Sheet Name'
dropdown_col = 'Dropdown column name'
origin_sheet = 'Origin Sheet Name'
origin_col = 'Origin Column Name'
col_type = 'MULTI_PICKLIST'
frst_sheet = 'First Sheet Name'
scnd_sheet = 'Second Sheet Name'
frst_key_col = 'First Search Column'
frst_val_col = 'First Co-dependent Column'
scnd_key_col = 'Second Search Column'
scnd_val_col = 'Second Co-dependent Column'
convert your .py file to an exe, for an example how to do this visit: https://pypi.org/project/auto-py-to-exe/
After this, using the project is as simple as clicking on the executable!
The first time it will ask you to enter your API key.
From the smartsheet home screen, access your account, and click on Apps & Integrations...
Here an API key can be generated by selecting 'API Access' and clicking on 'Generate new access token'
Be aware, you may need owner or admin rights for the sheets you wish to edit
Paste this key into the terminal and press enter.
The program will ask you to renew your API key once every week.
Some things worth noting when using this program:
The make_dropdown
function right now only fills the options and sets the column type. It does not change other settings of the column, these features could be added upon request.
The same applies to the compare_dict
function. In this case, the smartsheet option 'Restrict to list values only' option might cause trouble, when trying to write an option that is not in the list.
The make_dropdown
function makes a new options list anytime it is run, meaning if values are removed from the origin column, they will also be removed from the dropdown picklist.
The compare_dict
function appends new values to the cell. this means it does not have the ability to remove values from cells. this means that if you have a value that needs to be removed, it will need to be removed from both sheets.
If there is need for a function that can remove values from a picklist cell, please open an issue of for the repo if you want to contribute.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Daan van Haastern - [email protected]
Project Link: https://github.com/Daan-Haas/smartsheet