Excel & XLSX Exports
Teirac facilitates data portability and reporting through a robust Excel export system. Leveraging the xlsx (SheetJS) library, the platform allows users to transition live project data from the web interface into structured, offline-ready .xlsx spreadsheets.
Overview
The export system is designed to transform complex relational project data—ranging from budget line items to risk registers—into flattened, human-readable workbooks. This feature is primarily used for:
- External Reporting: Sharing project status with stakeholders without platform access.
- Offline Analysis: Performing advanced financial modeling or data manipulation in Excel.
- Data Backups: Maintaining local snapshots of project milestones and task lists.
Exportable Project Modules
The system supports exporting data from several specialized project modules. Each module corresponds to a specific data structure within the Teirac ecosystem:
| Module | Data Included | | :--- | :--- | | Project Financials | Budgets, spent amounts, and cost-benefit analysis. | | Schedule & Tasks | WBS codes, task owners, start/end dates, and completion percentages. | | Risk & Issues | Risk levels, descriptions, priority, and status notes. | | Resources | RACI matrices, stakeholder influence maps, and resource allocation plans. | | Quality Control | Punch lists, ITR (Inspection Test Records), and gap analysis. |
How to Export Data
Exporting from a Project View
To generate an Excel report for a specific project:
- Navigate to the Project Detail page from your dashboard.
- Ensure the data tables you wish to export are populated.
- Click the Export to XLSX button (typically located in the header or module actions).
- The system will aggregate the current view's data and trigger an automatic download of the
.xlsxfile.
Data Mapping
Teirac ensures that data types are preserved during the export process:
- Dates: Converted to Excel-compatible date formats.
- Metrics: SPI (Schedule Performance Index) and percentage values are exported as numerical values for easy calculation.
- Statuses: Badge-style statuses (e.g., "On Track", "At Risk") are exported as plain text strings.
Technical Details for Developers
The export functionality is primarily handled within ProjectPage.tsx using the xlsx library. The implementation follows a JSON-to-Sheet workflow.
Usage Example
When extending the export functionality, the system utilizes the following pattern to generate workbooks:
import * as XLSX from 'xlsx';
/**
* Generates an Excel file from project data rows
* @param data - Array of objects (e.g., tasks or budget items)
* @param fileName - Target filename
*/
const exportToExcel = (data: any[], fileName: string) => {
const worksheet = XLSX.utils.json_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, "Project Data");
XLSX.writeFile(workbook, `${fileName}.xlsx`);
};
Integration with Supabase
Data is fetched in real-time from Supabase before the export is triggered. This ensures that the generated spreadsheet reflects the most recent updates made by the project team, including live changes to task statuses or budget expenditures.
Troubleshooting
- Missing Data: If a column appears empty in the export, verify that the field is correctly mapped in the
TABLE_MAPconfiguration within the source code. - Format Issues: Ensure that the browser has permission to trigger "Automatic Downloads" when clicking the export button.