#### Editor URL
https://bubble.io/page?id=nocodelabplugins#### Demo URL:
https://nocodelabplugins.bubbleapps.io/version-test/advancedexporttoxlsx#### Step 1: Add the Plugin Action to Your Workflow
1. In the Bubble workflow editor, click **"Click here to add an action..."**
2. Navigate to **Plugins** → **Advanced JSON to Excel**
3. Select **"Advanced Export to XLSX"**
#### Step 2: Set the File Name
In the action settings, configure the **fileName** parameter:
```
fileName: "my-report"
```
The `.xlsx` extension will be added automatically if not included.
#### Step 3: Provide Your JSON Data
In the **jsonData** parameter, provide your JSON content. You can use:
- **Dynamic Expression**: `Do a search for:format as text`
- **API Connector**: Response data formatted as text
- **Custom States**: JSON stored in page/element states
- **Static JSON**: Hardcoded JSON for testing
**Example:**
```
jsonData: Get data from an external API:format as text
```
Or for database searches:
```
jsonData: Do a search for Orders:format as text
```
---
## JSON Structure Examples
### Simple Single-Sheet Report
```json
{
"reportInfo": {
"period": "January 2024",
"total": "$15,000"
},
"sales": [
{
"product": "Product A",
"quantity": 10,
"price": "$100"
},
{
"product": "Product B",
"quantity": 5,
"price": "$200"
}
]
}
```
**Result**: One Excel sheet with a key-value section for "reportInfo" and a table for "sales"
---
### Multi-Sheet Workbook (Advanced)
For multiple sheets, add an `_excelConfig` object:
```json
{
"_excelConfig": {
"fileName": "company-report-2024",
"multiSheet": true,
"metadata": {
"title": "Company Report",
"author": "Your Company Name",
"subject": "Annual Report"
},
"sheets": [
{
"sheetName": "Sales Data",
"dataKey": "sales"
},
{
"sheetName": "Expenses",
"dataKey": "expenses"
}
]
},
"sales": [
{ "product": "Product A", "revenue": "$5000" },
{ "product": "Product B", "revenue": "$3000" }
],
"expenses": [
{ "category": "Marketing", "amount": "$2000" },
{ "category": "Operations", "amount": "$1500" }
]
}
```
**Result**: Excel file with 2 sheets: "Sales Data" and "Expenses"
---
## Configuration Parameters
| Parameter | Type | Required | Description | Example |
|-----------|------|----------|-------------|---------|
| **fileName** | Text | No | Name of the Excel file (without extension) | `"monthly-report"` |
| **jsonData** | Text/JSON | Yes | JSON data to convert to Excel | `Search:format as text` |
### Parameter Details
#### fileName (Optional)
- Default: `"auto_report"`
- Extension `.xlsx` is added automatically
- Can include or exclude the extension
#### jsonData (Required)
- Accepts JSON as a **text string** or **JSON object**
- Can be generated using Bubble's **"format as text"** option
- Must be valid JSON structure
---
## Advanced Features
### Custom Sheet Names (Single Sheet)
```json
{
"_excelConfig": {
"sheetName": "Q1 Sales Report"
},
"sales": [
{ "month": "January", "revenue": "$10000" }
]
}
```
### Excel Metadata
```json
{
"_excelConfig": {
"metadata": {
"title": "Annual Financial Report",
"subject": "2024 Financials",
"author": "Finance Department",
"company": "Acme Corporation"
}
},
"data": [ ... ]
}
```
---
## Common Use Cases
### Use Case 1: Export Search Results
**Workflow Setup:**
1. Add action: "Advanced Export to XLSX"
2. Set fileName: `"customer-list"`
3. Set jsonData: `Do a search for Customers:format as text`
### Use Case 2: Export Order Invoice
**Workflow Setup:**
1. Add action: "Advanced Export to XLSX"
2. Set fileName: `Current Order's Invoice Number`
3. Set jsonData: `Current Order:format as text`
### Use Case 3: Export Multi-Sheet Report
**Workflow Setup:**
1. Create a custom state or use API Workflow to build the multi-sheet JSON structure
2. Add action: "Advanced Export to XLSX"
3. Set fileName: `"company-report"`
4. Set jsonData: `Custom state multiSheetData:format as text`
---
## Troubleshooting
### Issue: Empty Excel File Generated
**Solution:** Ensure your JSON is properly formatted as text:
- Use **"format as text"** in your Bubble expression
- Verify the JSON structure is valid (use a JSON validator)
- Check browser console for error messages
### Issue: File Not Downloading
**Solution:**
- Ensure the XLSX library is loaded (check plugin dependencies)
- Test with a simple JSON structure first
- Verify browser allows file downloads
### Issue: Data Not Displaying Correctly
**Solution:**
- Check your JSON structure matches one of the supported formats
- Arrays of objects become tables
- Simple objects become key-value sections
- Ensure field names don't contain special characters
---
## Best Practices
1. **Use Descriptive Field Names**: Field names become Excel headers
2. **Keep Data Consistent**: All objects in an array should have the same structure
3. **Test with Sample Data**: Use static JSON first to verify the structure
4. **Use Multi-Sheet for Complex Data**: Separate different data types into different sheets
5. **Add Metadata**: Include file metadata for professional reports
---