How can I copy a row's attachements to another row with Bridge?


  • deepx3
    deepx3 ✭✭

    Don't know about Bridge, but I've done this before using the API.

    Here's two functions I wrote to save attachments to a local folder and then upload them to a different row.

    import smartsheet
    import urllib
    SS = smartsheet.Smartsheet(SMARTSHEET_ACCESS_TOKEN)
    def save_attachment(attachment_id, sheet_id, local_folder='Attachments'):
       url = SS.Attachments.get_attachment(sheet_id, attachment_id)
       urllib.request.urlretrieve(url.url, f".\{local_folder}\{}")
    def upload_attachment(file_name, local_folder, mime_type, row_id, sheet_id):
       SS.Attachments.attach_file_to_row(sheet_id, row_id, (file_name, open(f'./{local_folder}/{file_name}', 'rb'), mime_type))

    Use will differ based on your needs, but basically you just give it an attachment id and sheet id from your source sheet and row, and then feed it to your target sheet and row.

    Here's how I used it:

    for a in marcom_row['attachments']:
           save_attachment(a['id'], plan['sheetId'])
           upload_attachment(a['name'], 'MarCom Attachments', a['mimeType'], row_id, MARCOM_SHEET_ID)

    I'm iterating over each attachment in a source sheet, saving it locally, and then uploading it back to a different sheet and row.

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @Simon Van Wyk

    Adding attachments to a Smartsheet sheet is not directly supported as a module in Bridge.

    You may be able to ask your Customer Success Manager or hire a Solutions Consultant to see if they can create a custom module to help you achieve your goals, for example, by using the API like @deepx3 has outlined! (Thank you!)



  • I have created a "New Idea" asking for the creation of an Add Attachment method. Please go up vote. Thanks!