Possible to create a URL/Hyperlink for new item (Automatically)?

We would like to create a URL/Hyperlink for new item automatically...in the attached example I had to 1) Manually go to row, 2) Select Properties, 3) Copy the Row Link, 4) Paste the Row Link in the field. We would like this to happen automatically, so far everything I have read says it is not possible.


Someone have a clever workaround? Any/all assistance is appreciated, thanks.


Answers

  • SteyJ
    SteyJ ✭✭✭✭✭✭
    edited 02/15/24

    What is the intention of getting the Row URL? I'm sure this is possible using the publicly available API by getting the row ID, and then concatenating it to a URL for the sheet -- however, there may be some work arounds depending on why you need the row URL.

    If you want to go the API route, here is a script I've made with Python which can do this function for you:

    import smartsheet
    access_token = 'YOUR_ACCESS_TOKEN'
    smartsheet_client = smartsheet.Smartsheet(access_token)
    sheet_id = 'YOUR_SHEET_ID'
    sheet = smartsheet_client.Sheets.get_sheet(sheet_id)
    
    # RENAME "getRowId" WITH YOUR ROW COLUMN FOR PYTHON TO PASTE ROWID (replace this to your column name)
    columns = sheet.columns
    for column in columns:
        if column.title == "getRowId": 
            column_id = column.id
            break
    
    # Append the row ID of each row to column_id column (getRowId)
    rows = sheet.rows
    for row in rows:
        row_id = row.id
        cell = smartsheet.models.Cell()
        cell.column_id = column_id
        cell.value = row_id
        updated_row = smartsheet.models.Row()
        updated_row.id = row.id
        updated_row.cells.append(cell)
        smartsheet_client.Sheets.update_rows(sheet_id, [updated_row])
    

    With this python script, I was able to achieve the desired result here:

    Where Base URL column is the formula

    ="https://app.smartsheet.com/sheets/SHEET_URL_HERE?rowId=" 
    

    and where Full URL is just:

    =[Base URL]@row + getRowId@row
    

    You could also just entirely remove the Full URL column and change the base column to be:

    ="https://app.smartsheet.com/sheets/SHEET_URL_HERE?rowId=" + getRowId@row
    

    Hope this helps!

    Sincerely,

    Jacob Stey