Prepending or Appending Cell Value to Attachment File Name

Hi! I found this discussion topic in which "Phillip" asks "to see a feature associated with the template/document create/edit functionality, which would allow me to optionally designate one or more fields from my sheet to use as the filename for the document attachment..."

However, I cannot find the solution on how to accomplish prepending or appending text that's in a cell to a file name that is attached on that row. Can someone please help me find the detailed steps?




  • jmyzk_cloudsmart_jp
    jmyzk_cloudsmart_jp ✭✭✭✭✭✭

    Hi @Lettyg

    Regarding your requirement to automatically prepend or append text from a cell to the file names of attachments in Smartsheet, you can use Smartsheet API to accomplish this. Although the Smartsheet API doesn't offer a direct method to rename an attachment, this can be achieved through a custom solution:

    1. Automated Download and Renaming:
    • Method: A script with the Smartsheet API is used to automate the process. The script will:
    • Retrieve attachments from each row in Smartsheet.
    • Identify the specific cell content in the row you wish to prepend or append.
    • Download the attachments automatically and rename them by including the cell value in the file name. It's all done locally on your machine.
    • Pros: This efficient method automates the renaming process, ensuring each attachment is correctly labeled with the respective cell value. It doesn't alter the original attachments in Smartsheet.
    • Cons: The updated file names will not be reflected in Smartsheet since the renaming occurs locally. Requires local storage space for the downloaded and renamed files.
    1. Delete, Rename, and Re-upload (Manual):
    • Method: If you need the renamed files to be visible in Smartsheet, you could delete the original attachments, use a similar script to rename them locally, and then re-upload them to Smartsheet.
    • Pros: Ensures that the renamed files are updated and visible within Smartsheet.
    • Cons: More time-consuming and involves the risk of data loss during the deletion process. It also requires additional bandwidth for both downloading and uploading files.

    Here is a demo Python code for the first method.