CalcTree Help Pages
  • What is CalcTree?
  • Getting started
    • CalcTree Pages
    • Create a CalcTree Page
    • Add a calculation
    • Collaborate with a colleague
  • Calculations
    • Parameters
      • Math formulas
        • Parameter Data Types
        • Native Functions
          • Arithmetic Functions
          • Trigonometric Functions
          • Logical & Comparison Functions
          • Matrix & Vector Functions
          • Probability & Combinatorics Functions
          • Statistical Functions
          • String Functions
          • Utility Functions
          • Other Native Functions
        • Valid Expression Syntax
      • Supported Units
      • Dropdown List Parameters
        • Linking CSV Data to Dependent Dropdowns in CalcTree
      • Parameter Settings
    • Integrations
      • Python in CalcTree
        • Adding a Python Source
        • Defining Parameters in Python
        • Referencing Other Parameters in Python
        • Working with Units in Python
        • Creating Tables and Visuals in Python
        • Consuming Files in Python
        • Using Pre-installed Python Libraries
      • Spreadsheets [Coming Soon!]
      • File Upload
        • CSV files
      • 3rd Party Software Plugins
        • Excel
        • Grasshopper
        • ETABS [v20 & v21]
        • ETABS [v22]
        • SAP 2000
        • CSI Bridge [v26]
    • Templates [Coming Soon!]
    • Optimising your calculations
  • Pages & Reports
    • CalcTree Documents
    • Static content
    • Parametric content
      • Parametric equation
      • Inputs
      • Outputs
  • Export to PDF
  • API
    • GraphQL API
      • Generating an API key
      • Queries
        • GetCalculation
        • Calculate
      • Examples
        • Bulk calculations with Python
  • Collaborate
    • Add members
    • Review and approval
    • Add stakeholders
  • Administrate
    • CalcTree Workspace
    • Versioning and Audit trail
  • CalcTree for System Administrators
Powered by GitBook
On this page
  • Uploading Files (Learn more here)
  • Accessing Files in Python
  • Use Cases
  • Notes
  1. Calculations
  2. Integrations
  3. Python in CalcTree

Consuming Files in Python

Create Python-powered calculations

PreviousCreating Tables and Visuals in PythonNextUsing Pre-installed Python Libraries

Last updated 1 day ago

You can upload any file type to a CalcTree page and access it directly within your Python script. This is useful for referencing input datasets such as CSVs, DXF files, or configuration files.

Uploading Files (Learn more )

To upload a file:

  1. Open the right-hand integrations panel on your CalcTree page

  2. Click + Add

  3. Select File Upload and select your file

  4. Once uploaded, the file will appear in the “Uploaded files” section

Accessing Files in Python

Uploaded files are accessible through the ct.page_files dictionary using the file name as the key. For example:

import pandas as pd

# Load a CSV file uploaded to the page
df = pd.read_csv(ct.page_files['my_input_data.csv'])

This pattern works for any file type compatible with your chosen Python libraries.

Use Cases

  • Load tabular data using pandas.read_csv()

  • Import geometric or CAD files (e.g. .dxf) using domain-specific libraries

Notes

  • File names must match exactly (including extension)

  • Uploaded files are only available within the page they are uploaded to

  • Large files may increase processing time

Use in conjunction with to automate processing of data files from ETABS etc. into reports in CalcTree

For file upload instructions, refer to our . To see this in practice, check our examples.

plugins
CSV File Upload Guide
template
here