Is there a Formula I can write in a cell to pull in the ATTACHCOUNT or the ROWID etc

edited 03/20/24 in Formulas and Functions

In ODBC export I can see the following which I could use to create custom URL's to a specific row, and filters based on HasAttachment or not.

The PowerBI Connector doesn't seem to pull these fields in?

Is there a Formula I can write in a cell to pull in the ATTACHCOUNT or the ROWID etc


  • David Jasven
    David Jasven ✭✭✭✭

    To access or generate ATTACHCOUNT and ROWID fields in Smartsheet using formulas directly in a cell is not directly supported through standard Smartsheet functions available in the UI. These fields are typically accessed through Smartsheet's API for programmatic access or through the ODBC connector for reporting and data analysis purposes.

    However, you can utilize the Smartsheet API to programmatically retrieve these values and then use them within your sheets if necessary. Here's a basic approach to get started with the API for this purpose:

    1. Retrieve Row IDs: You can use the GET /sheets/{sheetId}/rows endpoint to fetch rows from a sheet, which will include each row's ID.
    2. Count Attachments: The GET /sheets/{sheetId}/attachments endpoint can list all attachments in a sheet, but to count attachments per row, you might need to iterate through rows or use specific filters if available through the API.

    For automation within Smartsheet without resorting to external scripts or integrations, you would generally need to find a workaround, such as manually inputting these values or using a more complex setup involving third-party services like Zapier or Smartsheet's own Automation features to update a sheet based on triggers (though this would not directly use ATTACHCOUNT or ROWID as dynamically pulled formulas).

    Here is an example of how you might use the API in a Python script to get the row IDs and attachment counts for a specific sheet. This assumes you have generated an API token:

    import requests

    sheet_id = 'your_sheet_id_here'

    api_token = 'your_api_token_here'

    # Headers for API request

    headers = {

      'Authorization': f'Bearer {api_token}',

      'Content-Type': 'application/json',


    # Fetch rows to get row IDs

    response_rows = requests.get(f'{sheet_id}/rows', headers=headers)

    rows_data = response_rows.json()

    # Iterate through rows to possibly count attachments if endpoint available or through logic

    # This is a placeholder for logic to count attachments per row, as a direct count is not provided in a single API call

    for row in rows_data.get('rows', []):

      row_id = row['id']

    # Placeholder for counting attachments logic

    # Note: Direct counting of attachments per row might require additional logic or API calls based on your needs

    This script is a starting point and will need adjustments based on your specific requirements, especially for counting attachments per row since it involves additional logic or possibly multiple API calls.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!