Documentation Index
Fetch the complete documentation index at: https://docs.jinba.io/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Data Conversion Tools provide essential functionality for transforming data between different formats. These tools handle array-to-CSV conversion, image-to-PDF conversion, and other data transformation needs in your workflows.
Key Features
ARRAY_TO_CSV
- Convert 2D arrays to CSV format
- Simple and efficient conversion
- Maintains data structure and relationships
- Compatible with spreadsheet applications
CONVERTER_ARRAY_TO_CSV
- Enhanced CSV conversion with automatic escaping
- Handles special characters (quotes, commas, newlines)
- Robust data sanitization
- Newline-joined string output
CONVERTER_IMAGE_TO_PDF
- Convert images to PDF format
- Support for PNG, JPEG, GIF, and more
- High-quality conversion
- Batch processing capabilities
Authentication
No authentication required for conversion tools.
Example: Data Export to CSV
- id: fetch_data
name: fetch_data
tool: PYTHON_SANDBOX_RUN
input:
- name: code
value: |
# Sample data processing
import json
# Simulate fetching data from API or database
raw_data = [
{"name": "John Doe", "email": "john@example.com", "age": 30, "city": "New York"},
{"name": "Jane Smith", "email": "jane@example.com", "age": 25, "city": "Los Angeles"},
{"name": "Bob Johnson", "email": "bob@example.com", "age": 35, "city": "Chicago"}
]
# Convert to 2D array format
headers = ["Name", "Email", "Age", "City"]
data_rows = []
data_rows.append(headers)
for item in raw_data:
row = [item["name"], item["email"], str(item["age"]), item["city"]]
data_rows.append(row)
print(json.dumps(data_rows))
- id: convert_to_csv
name: convert_to_csv
tool: CONVERTER_ARRAY_TO_CSV
input:
- name: array
value: "{{steps.fetch_data.result.stdout | fromJson}}"
- id: save_csv_file
name: save_csv_file
tool: OUTPUT_FILE
input:
- name: content
value: "{{steps.convert_to_csv.result.csv}}"
- name: filename
value: "user_data_export.csv"
- name: fileType
value: "csv"
Example: Sales Report Generation
- id: calculate_sales_metrics
name: calculate_sales_metrics
tool: PYTHON_SANDBOX_RUN
input:
- name: code
value: |
import json
from datetime import datetime, timedelta
# Sample sales data
sales_data = [
{"product": "Widget A", "sales": 1500, "region": "North", "month": "Jan"},
{"product": "Widget B", "sales": 2300, "region": "South", "month": "Jan"},
{"product": "Widget A", "sales": 1800, "region": "North", "month": "Feb"},
{"product": "Widget B", "sales": 2100, "region": "South", "month": "Feb"}
]
# Create summary table
summary = [["Product", "Region", "Month", "Sales", "Growth"]]
for i, item in enumerate(sales_data):
growth = "N/A"
if i >= 2: # Calculate growth for Feb data
prev_sales = sales_data[i-2]["sales"]
growth = f"{((item['sales'] - prev_sales) / prev_sales * 100):.1f}%"
summary.append([
item["product"],
item["region"],
item["month"],
f"${item['sales']:,}",
growth
])
print(json.dumps(summary))
- id: export_sales_csv
name: export_sales_csv
tool: ARRAY_TO_CSV
input:
- name: array
value: "{{steps.calculate_sales_metrics.result.stdout | fromJson}}"
- id: create_downloadable_report
name: create_downloadable_report
tool: OUTPUT_FILE
input:
- name: content
value: "{{steps.export_sales_csv.result.csv}}"
- name: filename
value: "sales_report_{{date | format('YYYY-MM-DD')}}.csv"
- name: fileType
value: "csv"
Example: Image to PDF Conversion
- id: input_images
name: input_images
tool: INPUT_IMAGE_FILE
input:
- name: file_url
value: "https://example.com/chart1.png"
- name: description
value: "Sales chart image"
- id: convert_chart_to_pdf
name: convert_chart_to_pdf
tool: CONVERTER_IMAGE_TO_PDF
input:
- name: image_url
value: "{{steps.input_images.result.file_url}}"
- name: filename
value: "sales_chart.pdf"
- id: batch_image_conversion
name: batch_image_conversion
tool: PYTHON_SANDBOX_RUN
input:
- name: code
value: |
# Process multiple images for PDF conversion
image_urls = [
"https://example.com/chart1.png",
"https://example.com/chart2.png",
"https://example.com/chart3.png"
]
conversion_tasks = []
for i, url in enumerate(image_urls):
task = {
"step_id": f"convert_image_{i+1}",
"tool": "CONVERTER_IMAGE_TO_PDF",
"image_url": url,
"filename": f"chart_{i+1}.pdf"
}
conversion_tasks.append(task)
print("Images ready for batch conversion")
print(f"Total images: {len(image_urls)}")
- id: extract_complex_data
name: extract_complex_data
tool: EXCEL_GET_ROWS
input:
- name: file_url
value: "{{steps.input_excel.result.file_url}}"
- name: range
value: "A1:F1000"
- id: transform_and_clean_data
name: transform_and_clean_data
tool: PYTHON_SANDBOX_RUN
input:
- name: code
value: |
import json
import re
# Parse the Excel data
excel_data = {{steps.extract_complex_data.result.content}}
# Clean and transform data
cleaned_data = []
headers = ["ID", "Name", "Email", "Phone", "Status", "Notes"]
cleaned_data.append(headers)
for row in excel_data[1:]: # Skip header row
if len(row) >= 6:
# Clean email
email = row[2].strip().lower() if row[2] else ""
# Format phone number
phone = re.sub(r'[^\d+]', '', row[3]) if row[3] else ""
# Clean and escape notes (may contain commas, quotes)
notes = str(row[5]).replace('"', '""') if row[5] else ""
cleaned_row = [
str(row[0]) if row[0] else "",
str(row[1]).title() if row[1] else "",
email,
phone,
str(row[4]).upper() if row[4] else "PENDING",
notes
]
cleaned_data.append(cleaned_row)
print(json.dumps(cleaned_data))
- id: convert_cleaned_data
name: convert_cleaned_data
tool: CONVERTER_ARRAY_TO_CSV
input:
- name: array
value: "{{steps.transform_and_clean_data.result.stdout | fromJson}}"
- id: save_cleaned_export
name: save_cleaned_export
tool: OUTPUT_FILE
input:
- name: content
value: "{{steps.convert_cleaned_data.result.csv}}"
- name: filename
value: "cleaned_data_export.csv"
- name: fileType
value: "csv"
CSV Conversion
- Input: 2D arrays, JSON arrays, structured data
- Output: RFC 4180 compliant CSV
- Features: Automatic escaping, encoding handling
Image to PDF
- Supported formats: PNG, JPEG, JPG, GIF, BMP, TIFF
- Output: High-quality PDF documents
- Features: Maintains image quality, proper scaling
Best Practices
CSV Handling
- Always include headers in your data arrays
- Handle special characters (commas, quotes, newlines)
- Use consistent data types within columns
- Validate data before conversion
Image Conversion
- Ensure images are accessible via public URLs
- Consider file size limitations
- Optimize images before conversion for better performance
- Use appropriate filenames for organization
Use Cases
- Data Export: Export database queries to CSV for Excel
- Report Generation: Convert processed data to spreadsheet format
- Document Creation: Convert charts and images to PDF
- Data Migration: Transform data between different systems
- Analytics Export: Export analysis results for stakeholders
- Backup and Archive: Convert data to portable formats
- Integration: Prepare data for external system import