Is there any way to sort 'List sheets' api response by date?

Options
mukund waghmode
edited 02/18/20 in API & Developers

I am using smartsheet data by calling its api's. Here I want to get my all sheets list in sorting order by date. Currently I am getting data in alphabetical order of sheet names. If there are 1000 records of my sheets then I want to get 100 records at a time by using query string parameter 'pagesize' but for remaining records I need to set the offset as modified date. Here records are not in sorting order by date so date offset is not working.

Could you please suggest is there any way to make records sorted by date?

Answers

  • mukund waghmode
    Options

    I want to sort api response by date. currently it is sorting by alphabetical order of sheet name.

  • Genevieve P.
    Genevieve P. Employee Admin
    Options

    Hi @mukund waghmode

    The default for getting a list of sheets is in alphabetical order by name; I don't currently know of a way to get this list by date (created or modified). You would first want to get all of the sheets, then re-order them on your end, afterwards.

    All the available actions for a "List Sheet" request can be found in our documentation, here: https://smartsheet-platform.github.io/api-docs/?python#list-sheets

  • mukund waghmode
    Options

    Actually I want to get all old sheet data by calling List Sheet api. After that I want to create some sheets and get only those sheets which are newly created. There is no api to get only newly created sheets.

    To do this I was thinking to get list of sheets sorted by date and save latest date. then use that date for next api call as query parameter 'modifiedSince' for newly created sheets.

    Is there any other way to do like this?

  • Genevieve P.
    Genevieve P. Employee Admin
    Options

    Hi @mukund waghmode

    Yes, you could use the  'modifiedSince' parameter to retrieve only newly created sheets from after a specific date (it would still list them in alphabetical order).

    I understand that the issue here is trying to find what the most recent date is from the original list. I would suggest that you could start by listing all sheets that were modified recently, such as yesterday, and work backwards until you find your most recently modified sheet. (Using a small search, instead of getting a list of all sheets and needing to sort through them).

    Then if you create new sheets, you'll know that today (or whenever you created those sheets) is the date to use in your next list search with the 'modifiedSince' parameter. Does that work for what you're looking to do?

    Thanks,

    Genevieve