Welcome to the Smartsheet Forum Archives


The posts in this forum are no longer monitored for accuracy and their content may no longer be current. If there's a discussion here that interests you and you'd like to find (or create) a more current version, pleaseVisit the Current Forums.

How to force a sheet to fully recalculate via the API

Rob Hagan
Rob Hagan ✭✭✭
edited 12/09/19 inArchived 2017 Posts

Hi there API Developer community,

I wish to use the API to force a sheet to recalculate.

Currently, we use a report that shows just the first row of every one of our 50 or so project sheets and then we manually copy a new value into a column on that report that we have put aside for the purpose. So, once a value like "Forced update 11-Jan-2017 03:18 PM" is copied down that column on the report and the report is saved, then every sheet shown on that report (appears) to be recalculated.

When I do the same action via the API, it does not appear to have the same outcome (but I am still testing).

Seeking some advice... (and I hope that I have expressed the situation sufficiently clearly)

Thanks in advance,

Rob.

PS, I just realised that you may be wondering why we need to do this recalculation.

在每个50名左右的项目表,有一个column called [Task Status]. [Task Status] shows values including "Completed", "In Progress", "In Progress Early" and "Overdue" and its value is calculated by formula using [Start Date], [End Date], [% Complete], [Row Type] and the function TODAY(). Trouble is that TODAY()'s value is (naturally) volatile.

We have many reports, but one particular report reads every project sheet and shows just the overdue tasks. If a project sheet is not opened for a few days, then the values in its [Task Status] column do not get recalculated and are days out of date. This leads to incorrect decision making. Our goal is to have a program that runs at least once per day and touches (causing recalculation) every project sheet. Thus, all of the reports that rely upon fields like [Task Status] will have reliable information.

Comments

  • Rob Hagan
    Rob Hagan ✭✭✭
    edited 01/11/17

    Hi again,

    Well, I may have been slightly premature but maybe others wanted to know the answer too.

    Overnight (here in Australia), I ran an experiment that appears to show that the update via the API of one cell in a SmartSheet sheetdoescause the formulas in that sheet to be recalculated.

    The experiment was to:

    Yesterday (11-Jan-2017)

    1) Set up a sheet SheetA with a set of rows with the formula =TODAY()=[Date Field]n in a checkbox column and to put yesterday's date, today's date, tomorrow's date, etc as hard dates in the successive [Date Field]s.

    2) Set up a report ReportA that shows all rows and all columns in SheetA and has "Highlight Changes since I last viewed" turned on.

    Today (12-Jan-2017)

    3) Run the Java program to touch a cell, other than those mentioned above, in SheetA.

    4) Open ReportA, but not SheetA.

    The report showed pretty yellow highlights where the cell representing yesterday went from checked to unchecked and the cell representing today went from unchecked to checked.

    I would be grateful if you can fault this logic (especially from the SmartSheet operations or development teams) as I would rather find out now that I have a basic misunderstanding than when I am relying on this technique in full production use.

    Cheers,

    Rob.

  • Jason
    Jason Employee

    HI Rob - I can confirm that editing a single cell in a sheet that contains formulas via the API will cause a formula recalc on the sheet.

  • Rob Hagan
    Rob Hagan ✭✭✭

    Thanks Jason,

    Excellent to see this "official" SmartSheet response via the Community.

    It really is appreciated (given my experience with products from other software vendors).

    Cheers,

    Rob.

  • Dear Rob hi.

    I've faced the same need (to update cells with Today() formula).

    Could you, please, tell in a bit more details how you "Run the Java program to touch a cell"?

    Thank you!

    Maxim

    P.S. I know nothing about API...

  • Rob Hagan
    Rob Hagan ✭✭✭

    Hi Maxim,

    As you probably know, an API has the ability to interact with your SmartSheet sheet via a program.

    After experimenting with a number of the languages that are supported by the SmartSheet API, I chose Java.

    所有的互动内容“touching” of the sheets takes place at 5am (local time) with no human interaction.

    A cron job is run on a spare server in the office and that cron job runs a unix script that invokes the Java program. The unix script collects the reporting that the Java program makes about its progress and emails that to me. Thus, I get a written report of each “touch” each morning when I start work. If SmartSheet is not working properly, the report will show that the "touch" failed.

    The program that I wrote retrieves all of the sheets in a nominated workspace and then updates a nominated cell in row 1 of each sheet with text like “Updated automatically at ”. Every one of our sheets is structured in the same way, and we use row 1 to contain metadata about the sheet. This allowed us to designate one cell in the first row for the "touching". That cell is not used for any other purpose.

    The unix script invokes the Java program once for each of four workspaces, as our production sheets are spread across four workspaces in order to restrict access to different classes of users.

    There are about 200 lines of code in the Java program and about 100 lines of unix script.

    This development required competence in unix commands, unix scripting and Java programming.

    Cheers,

    Rob.

  • J. Craig Williams
    J. Craig Williams ✭✭✭✭✭✭
    edited 09/17/17

    If you only have a few sheets, Zapier is also an option.

    This is one way I do it. This requires no programming knowledge as Zapier is fairly straightforward.

    http://ronin-global.com/2017/03/15/forcing-today-refresh-in-smartsheet/

    UPDATE: 2017-0917 - my solution has changed slightly and the post updated to reflect new method.

    Craig

  • tcer
    tcer ✭✭✭

    I know this is an old thread, hoping maybe a built-in solution has come to the app since. Setting up new lists and having to add them to a API to refresh daily isnt really user friendly. Is there a way to set a 'refresh formulas every x time' into each list? Similar to how we have a refresh dashboard every x minutes.

  • tcer
    tcer ✭✭✭
    edited 02/12/19

    I too would really like a feature that auto refreshes the formulas in a sheet without opening it so that the reports are accurate. OR they refresh automatically when a report runs.

    edit: this should apply to conditional formatting as well

  • It's now July 2019 and still no fix. Ran into this problem AFTER spending weeks on setting up a super complicated set of sheets, reference sheets and ridiculous formulas. Now the whole hospital is getting inaccurate reports. Not cool. I submitted an enhancement ticket. I don't understand why the sheets would not automatically update when the sources change? What could possibly be the benefit of that???

  • Rob Hagan
    Rob Hagan ✭✭✭
    edited 07/15/19

    Probably some deep design tradeoff to improve performance at the expense of the desired functionality.

    For many years now, we have run the "touch" (via Java) of every active sheet at 5am Melbourne time to force all sheets to recalculate. We have a dedicated column (of a "hard coded" name) whose only purpose is to have its row 1 overwritten (ie. "touched") each early morning. No other cells in the sheet are modified. We also capture the success of each touch and email a digest of those outcomes to nominated individuals. If the digest shows fatal errors, then it is simple to do a manual "touch" via a report that shows every active sheet.

    We do have the situation where every one of our sheets has the same structure, but given that the "touch" program finds the column that it is to touch by its "hard coded" name then you may be OK with a design which has the column in different places in each sheet.

    We do have all of our active sheets in the one overall hierarchy, so the program does a tree traversal from the one root to find all of the candidate sheets.

  • tcer
    tcer ✭✭✭

    check out this thread. There is a solution using cell linking you might find useful.

    https://community.smartsheet.com/discussion/auto-refresh-data

This discussion has been closed.
Hi, <\/p>

Instead of applying the formula to \"Multiselect Text String\" row, did you tried with \"Multiselect Values\" row?<\/p>

=IF(HAS([Multiselect Values]@row, [Component ID]@row), \"MATCH\", \"NO MATCH\")<\/p>

Thank you,<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","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":[]},{"discussionID":109493,"type":"question","name":"I am having trouble using \"And\", \"OR\" & \"Countif(s)\" to build a formula.","excerpt":"Hello, I am attempting to come up with a sheet summary formula that counts cells if they meet at least one of 3 different statuses in the same column, AND also meet one of 5 different statuses in a separate column. So using the screenshot I've provided as an example (although it doesn't have 5 different statuses in the…","snippet":"Hello, I am attempting to come up with a sheet summary formula that counts cells if they meet at least one of 3 different statuses in the same column, AND also meet one of 5…","categoryID":322,"dateInserted":"2023-08-25T20:03:21+00:00","dateUpdated":null,"dateLastComment":"2023-08-26T00:34:49+00:00","insertUserID":165710,"insertUser":{"userID":165710,"name":"SmarsheetNewb","url":"https:\/\/community.smartsheet.com\/profile\/SmarsheetNewb","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:33:27+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"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-08-26T01:04:51+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":23,"score":null,"hot":3386005690,"url":"https:\/\/community.smartsheet.com\/discussion\/109493\/i-am-having-trouble-using-and-or-countif-s-to-build-a-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109493\/i-am-having-trouble-using-and-or-countif-s-to-build-a-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109493,"commentID":392692,"name":"Re: I am having trouble using \"And\", \"OR\" & \"Countif(s)\" to build a formula.","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392692#Comment_392692","dateInserted":"2023-08-26T00:34:49+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-08-26T01:04:51+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":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-26T00:33:25+00:00","dateAnswered":"2023-08-25T20:44:12+00:00","acceptedAnswers":[{"commentID":392662,"body":"

Try this:<\/p>

=COUNTIFS([Item Number]:[Item Number], OR(@cell = \"C001\", @cell = \"COO2\", @cell = \"COO3\", @cell = \"COO4\"), [Status]:[Status], OR(@cell = \"Green\", @cell = \"Yellow\", @cell = \"Red\"))<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","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":254,"urlcode":"formulas","name":"Formulas"}]},{"discussionID":109474,"type":"question","name":"Help with date calculation formula","excerpt":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the resolution date is blank I want it to use the current date in the calculation to see how long this issue has gone unresolved. Any help is much…","snippet":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the…","categoryID":322,"dateInserted":"2023-08-25T16:29:39+00:00","dateUpdated":"2023-08-25T16:29:59+00:00","dateLastComment":"2023-08-25T23:01:30+00:00","insertUserID":165688,"insertUser":{"userID":165688,"name":"Nwest","title":"Systems Analyst","url":"https:\/\/community.smartsheet.com\/profile\/Nwest","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ukHVZ18ImX4!BcjWAe8S9SY!l7iQo_PZHOx","dateLastActive":"2023-08-25T17:22:30+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":165688,"lastUserID":8888,"lastUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":23,"score":null,"hot":3385987269,"url":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109474,"commentID":392687,"name":"Re: Help with date calculation formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392687#Comment_392687","dateInserted":"2023-08-25T23:01:30+00:00","insertUserID":8888,"insertUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+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":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-25T17:04:22+00:00","dateAnswered":"2023-08-25T16:36:59+00:00","acceptedAnswers":[{"commentID":392622,"body":"

\n \n https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula\n <\/a>\n<\/div>\n

Hi, <\/p>

I hope you're well and safe!<\/p>

Try something like this.<\/p>

=IF([Date Reported]@row <> \"//www.santa-greenland.com/community/discussion/6929/\", IF([Resolution Date]@row = \"//www.santa-greenland.com/community/discussion/6929/\", NETDAYS([Date Reported]@row, TODAY()), NETDAYS([Date Reported]@row, [Resolution Date]@row)))<\/p>

Did that work\/help? <\/p>

I hope that helps!<\/p>

Be safe, and have a fantastic weekend!<\/p>

Best,<\/p>

Andrée Starå<\/strong><\/a> | Workflow Consultant \/ CEO @ WORK BOLD<\/strong><\/a><\/p>

Did my post(s) help or answer your question or solve your problem? Please support the Community by <\/em>marking it Insightful\/Vote Up, Awesome, or\/and as the accepted answer<\/em><\/strong>. It will make it easier for others to find a solution or help to answer!<\/em><\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","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":254,"urlcode":"formulas","name":"Formulas"}]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&siteSectionID=0&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":10000,"limit":3},"title":"Trending Posts","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

Trending Posts