Add auto refresh

Follow

Comments

13 comments

  • Avatar
    Marek Gazda

    How can I trigger AT_reload() function after submitting a form response by a user?

  • Avatar
    Awesome Table

    Hi Marek,

    You can only trigger the function auto refresh by specifying the time interval. 
    It is not possible to trigger this function only after an event as form responses.

    Thomas

  • Avatar
    Randolph Abelardo (Edited )

    @Marek, you can use Google FormsonFormSubmit trigger workaround:

    link the form to a GSheets Form Response, 

    then use the AwesomeTable Auto-Refresh script.

    Since the minumum argument required here is 15 seconds

    newly submitted form responses will be updated (reflected) in the AwesomeTable view in 15 seconds or less (which is not too much to wait for, don't you think?) Hope this works for your use-case.

     

    @Thomas, this approach / workaround will be included in the upcoming GeoCode tutorial.

  • Avatar
    Will

    Using the last example to make a "Refresh Data" button... is it possible to change the button type or make it an icon?

  • Avatar
    Awesome Table

    Hi Will,

    Indeed it is possible to change or customize the button. You just need to change it with CSS but it requires knowledge in code. 
    I suggest you to consult this article that could be useful for you.

    Regards,
    Thomas

  • Avatar
    Paul

    Is there a way to perform the refresh and stay on the page? For when I click refresh button in page 2 it will refresh and return to page 1.

    Thanks,
    Paul

  • Avatar
    Awesome Table

    Hi Paul,

    Unfortunately, it is not yet possible to stay on the same page when it's reloading. When your view is refreshed, you return automatically on the first page.

    Kind regards,
    Thomas

  • Avatar
    Paul (Edited )

    Thank you Thomas. Noted that. Hope you consider it for enhancement. Thanks again.

  • Avatar
    B Gorsky (Edited )

    I am using a form to populate a spreadsheet. When a new entry appears on the spreadsheet, I want the newest entry is at the top (i.e.: most recent). I was hoping to use the auto refresh feature, however I also need the newest entry at the top. Is this possible?

    Also, I am testing this on your announcements template. On the "Template" sheet, I added column D (as the template had A, B and C columns for style, etc. already), put <script> in row 1 and AT_reload(15); in row 2 but it isn't refreshing.

  • Avatar
    Awesome Table (Edited )

    Hi Gorsky,

    To sort your column and have the newest entry on top, you just need to use this formula in your script editor:

    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheets()[0];

    // Sorts the sheet by the first column, descending
    sheet.sort(1, false);

    Concerning your second problem, I think you need to check your data range (see the screenshot).

    Kind regards,
    Thomas

  • Avatar
    B Gorsky (Edited )

    Thomas - 

    The auto-refresh is now working. Does it only auto-refresh if changes are made to the sheet or regardless every X seconds?

    The script works to re-sort the spreadsheet with the newest at the top, but when the view refreshes, it is still being shown last in the awesome table view. Thoughts?

    -Brian

  • Avatar
    Awesome Table

    Hi B Gorsky,

    The auto-refresh is working every X seconds if you use "AT_reload(15);". In this example, you view will be reload every 15 seconds.

    If you want to refresh your view everytime you make changes on your view, you can use:
    "function reloadData(){
    AT_reload();
    }"

    It's strange your newest entry is displayed in last position in your view.

    Would it be possible for you to share your spreadsheet and your view at "[email protected]"? If you have sensitive data, you can make a copy with similar data. Juste make sure you give us access to your data.

    Thanks in advance. 

    Thomas

  • Avatar
    Randolph Abelardo (Edited )

    Hello @B Gorsky

    I'm assuming that since your Google Sheets datasource receives all your form responses, 
    that it automatically saves your response-timestamps. 
    If yes, you can simply use Query in AwesomeTable

    Let's say that your timestamps are housed in column A,
    you can use this Query statement:

    select * order by A desc


    This will tell AwesomeTable to display your form entries starting with the most recent submission.

    Note: If you have an existing Query statement, simply affix the order by clause at the end:
    (e.g. select G,B,A,C order by A desc)

    Click here to learn more about Queries (sort).
    (Read Task # 3)

    Hope this helps.

    - Randy