How to get template Id sheet has been created from?

Hello,

Is there a way to get template that was used for creating a sheet using API? What does "source" property of a sheet means?

Thanks

Answers

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Project Migrator

    Yes, the "source" will identify if the sheet was created from a Template. The ID before the Type will tell you the Template ID.

    {

    "source": {

    "id": xxxx,

    "type": "template"

    },


    See: https://smartsheet.redoc.ly/#section/Source-Object

    Cheers,

    Genevieve

  • Hello,

    I have just created a project sheet and source object for it is following

    "source": {

    "id": 6755404643362692,

    "type": "sheet"

    },

    I have noticed, that every project sheet in our tenant has the same source Id for our project sheets. But I cannot see the template with such Id.

    Is there a way to find the original template using this source Id?


    Thanks,

    Michael

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Project Migrator

    That specific ID is the source when you create a Project type of sheet directly from within Smartsheet:


    You can search for a Template or for a Sheet using the ID, however since that source "sheet" doesn't actually exist, you'll receive an error if you try to Get:

    https://api.smartsheet.com/2.0/sheets/6755404643362692

    Let me know if that helps clarify!

    Cheers,

    Genevieve

  • Genevieve,

    Does it mean that I cannot get real template Id for sheets created from UI?


    Thanks,

    Michael

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Project Migrator

    If your sheet was created from a Template type of Smartsheet item in the UI, then this Template will have a unique ID that you can get and identify.


    However if the sheet was created directly from the "Create" button, then the Source ID will be the one you identified above:

    "source": {

    "id": 6755404643362692,

    "type": "sheet"

    },

    This ID indicates that the sheet was created right from the "Create" button, not from a "Template" type of item. Here's more information on Templates: Templates: Create Your Own or Use One from the Solution Center

    Let me know if this makes sense, now!

    Cheers,

    Genevieve

  • Genevieve,

    Last question. Is the Id 6755404643362692 the same for projects created from UI for all smartsheet tenants? Can I hardcode it to match a project with the Project template?


    Thanks,

    Michael

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Project Migrator

    The ID of 6755404643362692 is specific to selecting "Project" from the Create button.

    For example, if you selected "Cards", the Source ID would be 2814754969413508 instead:


    The "Task List" option has an ID of 2251805015992196. You can find all of these IDs by creating a sheet then using Get Sheet with the parameter of including "Source".


    Keep in mind that a user may have created a sheet by selecting "Grid" and then manually applying Project Settings to end up creating a Project Sheet, without actually using the "Source" of "Project".

    In this instance it would have a different Source ID since the original sheet was a "Grid" but the content was updated later. You could also create a Task List or a Card View type of sheet and then change it to be a Project sheet, or use an actual Template from the Solution Center.

    Cheers,

    Genevieve

  • Genevieve,

    Is it possible to apply Project settings using API?


    Best regards,

    Michael

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Project Migrator

    What is it exactly that you are looking to do?

    The Sheet Object has a Project Settings Object with lengthOfDay, nonWorkingDays, and workingDays. There's also a boolean value to enable Gantt View.

    However there currently isn't a way to enable dependencies via the API. You would perhaps want to create a Template type of item directly in the UI with all of the Project Settings you want applied, then you could use the API to create sheets out of that Template that you created.

    Cheers,

    Genevieve

  • Genevieve,

    I store some sheet information and in case of sheet is deleted I need to recreate it with the same template. According to your information about applying Project Settings to any type of sheets I want to know if it possible to "convert" any sheet to a project sheet using API.


    Thanks,

    Michael

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Project Migrator

    If you want to save sheet data, you could create a copy of that sheet with Save as New (this can be done via the API). Saving as New will keep the same Project Settings you have applied to that specific sheet. See: Copy a sheet with Save as New

    Keep in mind that deleted items are also still available in the Owner's Trash for 30 days: Recover a Deleted Sheet

    If you already have a regular Grid sheet created, you can turn it into a Gantt sheet with the boolean value: https://smartsheet.redoc.ly/#tag/sheetsObjects

    ganttEnabledboolean
    Indicates whether "Gantt View" is enabled.
    

    You can also define the length of working days and what working days are, as noted above.

    However, if you are looking for more complex settings (such as enabling Dependencies), then no, you won't be able to do this via the API. I would still recommend saving a copy of your sheet and turning it into a Template you can keep somewhere in your account. That way you can create a new sheet from this Template that automatically has all of your custom pre-set elements defined.


  • Genevieve,

    Thank you very much. I appreciate you help.


    Best regards,

    Michael