How to add cell dependancies using (python) API

stphnwallace
stphnwallace ✭✭
edited 03/13/23 in API & Developers

Hi community!

I'm not the API dev, just asking about API capabilities.

I know its possible to create dependencies in the GUI by specify a row number for example.

If we're creating via API, we may not know the row number. Is it possible to specify the relationship by cell "Task Name" for example.

Can I specify a dependency for a task "drink_beer" as "buy_beer_from_shop" rather

than e.g. [33]?

We're using python to speak to the API should this help.

I run big events with many related tasks. I'm a bit stuffed creating multiple big sheets via the API if this bit does not work.

Your help is appreciated.

Answers

  • ericncarr
    ericncarr ✭✭✭✭

    @stphnwallace - If I'm understanding your question correctly, is there something preventing you from looking up the row based on the cell value in the "Task Name" column, grabbing the row number, and then setting the predecessor in the row you want to add it to?

    ##For instance, when you have the sheet, you can identify the "Task Name" column:

    for column in (column for column in full_sheet.columns if column.title == "Task Name"):

    taskcolid = column.id

    ##Then iterate through the rows to find where the cell value equals whatever task name you're looking for:

    for row in full_sheet.rows:

              for cell in (cell for cell in row.cells if cell.value == 'UPL Project Task Modules'):

                row_number = row.row_number

    Then you can just plug in row_number wherever you need it. Personally, I'd create a function (or maybe 2) that you can just call while iterating through a list of predecessors relationships you'd like to create.

  • Thanks Erin. I'll pass this suggestion on to my dev to give it a try!

    :)