Python Script For Refresh Sheet
Hello Smartsheet Community,
I need to write a script in Python to refresh a sheet. In my sheet I am using the Today function to calculate the total net days from one specific date. I take that data and use it as a widget on my dashboard. Problem is, the widget doesn't update unless the I physically open the sheet.
Is there a way to write a script that doesn't need to use the webbrowser.open() function? Is there a way that I can link using the API and do some sort of boolean run through a column? I don't want to change anything in the sheet, I just need to reflect an open browser status or open sheet status so the Today() function will update appropriately.
My first pass was to do a webbrowser.open(sheet url link) then close it but I am having trouble finding the HTML code for the login page so I can automate the username/password. Any suggestions?
Thanks,
Veronica
Comments
-
Working in Smartsheet in your browser the formulas on a sheet are evaluated each time the sheet is loaded. You can simulate this to get the formulas to evaluate using the Smartsheet API. If a change is made to a sheet, including one via the API, the formulas on the sheet will all be run and any new values they calculate will be saved. So, if you can automate a script to make a request to a sheet and change any value on it the formulas will be run and the TODAY functions will update to the current date for your dashboard.
This can be done by making any change to a cell value on the sheet. You could insert a column that you keep hidden to use for this purpose. Then you can update a single cell in that sheet with a new value. Note, that if you send the same value over and over it won't work. The API will ignore any change when you provide the same value that is already found in the sheet. It needs to be a new value each time.
There is an SDK for the Smartsheet API for Python that you can find information on here:
https://github.com/smartsheet-platform/smartsheet-python-sdk
Usage of the Smartsheet API is all described in the API docs:
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.6K Get Help
- 433 Global Discussions
- 136 Industry Talk
- 468 Announcements
- 4.9K Ideas & Feature Requests
- 143 Brandfolder
- 147 Just for fun
- 64 Community Job Board
- 466 Show & Tell
- 32 Member Spotlight
- 2 SmartStories
- 298 Events
- 36 Webinars
- 7.3K Forum Archives