Exporter Nodes & Cloud Egress: Word, Excel, PDF & Google Drive
Export compiled documents, narrative prose, and structured tables to .docx, .xlsx, .csv, .md, .pdf, .txt, or directly into native Google Docs and Google Sheets.
# Exporter Nodes & Cloud Egress: Word, Excel, PDF & Google Drive
The **Document Exporter Node** (`exporterNode`) completes Nodestr's end-to-end authoring lifecycle ($\text{Ingest} \rightarrow \text{Author & Compile} \rightarrow \text{Export}$). Whether you are assembling a multi-chapter manuscript, a technical specification with embedded tables, or a structured spreadsheet dataset, the Exporter Node transforms your live graph into production-ready local files or cloud documents in a single click.
---
## 1. Dual Left Input Ports
Every Document Exporter Node features two specialized input handles on its left edge:
1. **`Document / Text` (`in-content`, Emerald Green)**:
- Accepts compiled text streams from an **Output Hub** (`out-main`), standard **Custom / Prompt Nodes**, **Group Nodes**, or a **Universal Loader Node** (`Raw Out`).
- Supports full Markdown formatting including headings (`H1`–`H6`), bold/italic/strikethrough runs, inline code, blockquotes, bulleted/numbered lists, and embedded Markdown pipe tables (such as those injected via `{{Table}}`).
2. **`Table Data` (`in-table`, Royal Blue)**:
- Accepts direct tabular connections from one or more **Table Nodes** (`out-table-bundle`).
- Preserves native column schemas, row records, and table titles for lossless spreadsheet and document table generation.
> [!TIP]
> You can connect **either** port individually or **both** ports simultaneously! The Exporter Node's Smart Payload Detection Engine automatically inspects your incoming connections and adapts the output structure.
---
## 2. Supported Export Targets (8 Formats)
The Format Selector dropdown organizes export targets into two categories:
### 📄 Documents
- **Microsoft Word (`.docx`)**: Generates a 100% native Office Open XML document client-side. Converts Markdown headings into styled Word Heading levels, preserves bold/italic/code runs and lists, and renders both connected Table Nodes and embedded Markdown pipe tables as native bordered Word tables with shaded header rows.
- **Google Docs (Cloud)**: Pushes your document directly to Google Drive and converts it into an editable native **Google Doc**, returning a 1-click **`[ ↗ Open in Google Docs ]`** link right on the node.
- **PDF Document (`.pdf`)**: Launches a clean, print-ready document layout with crisp typography, page-break control, and bordered data tables.
- **Markdown (`.md`)**: Downloads a clean UTF-8 Markdown file containing your compiled prose and GitHub-Flavored Markdown pipe tables.
- **Plain Text (`.txt`)**: Strips Markdown syntax tokens while preserving clean paragraph spacing and readable tabular alignment.
### 📊 Spreadsheets
- **Microsoft Excel (`.xlsx`)**: Generates a native multi-sheet Excel workbook with auto-sized column widths.
- **Google Sheets (Cloud)**: Uploads and converts your dataset directly into an editable native **Google Sheet** with a 1-click **`[ ↗ Open in Google Sheets ]`** badge.
- **CSV Spreadsheet (`.csv`)**: Exports an RFC-4180 compliant comma-separated values file with UTF-8 BOM for universal compatibility with Excel, Numbers, and data pipelines.
---
## 3. Smart Payload Detection Matrix
As you wire nodes into the Exporter Node, the **Smart Detection Card** analyzes the incoming stream and classifies it into one of three modes:
| Payload Mode | Incoming Connections | How Document Formats (`.docx`, `Google Docs`, `.pdf`) Adapt | How Spreadsheet Formats (`.xlsx`, `Google Sheets`, `.csv`) Adapt |
| :--- | :--- | :--- | :--- |
| **`table-only`** | `TableNode` connected to `in-table` (or table-only Output Hub) | Renders a titled document containing a formatted native table with shaded column headers. | Exports columns and records directly into the primary worksheet (`Sheet 1`). |
| **`text-only`** | Narrative / Prompt nodes connected to `in-content` (no tables) | Renders full rich typography (headings, paragraphs, lists, blockquotes). | Splits narrative lines into clean single-column rows (`Content` column) so no text is lost. |
| **`composite`** | Both narrative text and tables (via dual ports or `{{Table}}` tokens) | Interleaves narrative sections and native tables in exact reading order. | Creates a **multi-sheet workbook**: dedicated worksheet tabs for each table plus a `Narrative_Text` sheet! |
---
## 4. Direct Cloud Egress to Google Docs & Google Sheets
Exporting to **Google Docs** or **Google Sheets** uses Google Identity Services with a strict **privacy-first security model**:
1. **Non-Intrusive `drive.file` Scope**:
- Nodestr requests **only** the `https://www.googleapis.com/auth/drive.file` OAuth2 scope.
- This scope grants permission strictly to create new files exported by Nodestr—Nodestr **never** requests access to view, list, or modify your existing personal Google Drive files.
2. **In-Memory Session Token Caching**:
- Once you authorize Google Drive export during a session, the short-lived access token is cached strictly in browser memory so subsequent exports execute in 1 click without repeated consent popups.
- If you are signed into Nodestr with your email or Google account, Nodestr automatically passes a `login_hint` so Google selects your active account seamlessly.
3. **Rich Clipboard Fallback (`[ 📋 Copy Formatted ]`)**:
- Every Exporter Node also includes a **`[ 📋 Copy Formatted ]`** quick action button that writes rich HTML (`text/html`) and plain text (`text/plain`) to your system clipboard. You can paste directly into an open Google Doc, Google Sheet, Notion page, or email client with full table borders and heading styles intact.
---
## 5. Compiler Isolation & Security
- **Compiler Isolation Invariant**: Like Sticky Notes and Record Selectors, `exporterNode` is an egress sink. `OutputCompiler.ts` returns `[]` when traversing an Exporter Node so it never creates circular compilation loops.
- **Automatic Credential Scrubbing**: Before generating any local download or cloud upload, the export engine runs `scrubSecrets()` to ensure sensitive API keys (`sk-...`, `ghp_...`, Bearer tokens) are never accidentally leaked into exported files.