AI Function Generator
Generate validation rules, transforms, virtual columns, and regex patterns using plain-language instructions
The AI Function Generator in CSVBox helps you create JavaScript functions and regex patterns without writing code manually. Simply describe what you want in plain English, and CSVBox will generate compatible logic for your importer automatically.
AI generation is available across:
Validation Functions
Virtual Columns
Data Transforms
Regex Column Type
This feature is designed to help you build advanced import logic faster, reduce manual coding, and simplify complex validation or transformation workflows.
How It Works
Open a supported editor in CSVBox
Click the Generate button ✨
Describe the logic you want
CSVBox generates compatible JavaScript or regex code
Review the generated output
Insert and save the function
All generated code remains fully editable before saving.
Supported Features
Validation Functions
JavaScript validation logic
Virtual Columns
JavaScript computed column logic
Data Transforms
JavaScript transformation logic
Regex Column Type
Regular expression patterns
Writing Better Prompts
The quality of the generated output depends heavily on how clearly the requirement is described.
For best results:
Mention exact column names when possible
Clearly describe the expected output
Include formatting requirements
Add examples for complex logic
Focus on one task at a time
Avoid vague instructions
AI Generator for Validation Functions
Use AI to generate validation rules using plain-language descriptions instead of manually writing JavaScript validation logic.
Perfect for:
Email validation
Phone number validation
Date validation
Required field checks
Cross-column validation
Business-specific validation rules
Example Prompts
Email Validation
Prompt
Expected Behaviour
"user@example.com"→ valid"user@"→ invalid
Phone Number Validation
Prompt
Expected Behaviour
"(555) 123-4567"→ valid"123-456"→ invalid
Date Validation
Prompt
Expected Behaviour
"2023-12-25"→ valid"12/25/2023"→ invalid
Cross Column Validation
Prompt
Expected Behaviour
start_date="2023-01-01", end_date="2023-12-31"→ validstart_date="2023-12-31", end_date="2023-01-01"→ invalid
Validation Prompt Tips
For better validation results:
Start with action words such as:
validate
ensure
verify
require
check
Mention exact field names
Describe the validation condition clearly
Include valid and invalid examples for complex rules
Mention how blank or null values should behave
AI Generator for Virtual Columns
Generate computed or derived columns using natural-language instructions.
Instead of manually writing JavaScript logic, describe what the virtual column should calculate or return.
Perfect for:
Combining fields
Calculated totals
Derived statuses
Formatting dates
Extracting values
Building custom labels
Example Prompts
Full Name Column
Prompt
Expected Behaviour
"john"+"DOE"→"John Doe"
Total Price Calculation
Prompt
Expected Behaviour
quantity=5, unit_price=10.50→52.50
Date Formatting
Prompt
Expected Behaviour
"12/25/2023"→"December 25, 2023"
Status Generation
Prompt
Expected Behaviour
Past date →
"Overdue"Within 7 days →
"Due Soon"Future date →
"On Track"
Virtual Column Prompt Tips
Mention which fields should be used
Describe the expected output clearly
Specify formatting rules
Include examples for calculated logic
Focus on one generated field at a time
AI Generator for Data Transforms
Generate data transformation logic using plain-language instructions.
Use AI to clean, normalize, or reformat imported data automatically.
Perfect for:
Text normalization
Formatting cleanup
Phone number cleanup
Date conversion
Value mapping
Row transformations
Example Prompts
Email Standardization
Prompt
Expected Behaviour
" John.Doe@Example.COM "→"john.doe@example.com"
Phone Number Cleanup
Prompt
Expected Behaviour
"(555) 123-4567"→"5551234567"
Full Name Generation
Prompt
Expected Behaviour
"john"+"DOE"→"John Doe"
Date Formatting
Prompt
Expected Behaviour
"12/25/2023"→"2023-12-25"
Data Transform Prompt Tips
Start with action words like:
convert
remove
replace
format
normalize
combine
Specify the target column
Clearly describe the final output format
Include sample input/output values for complex transforms
Keep transformations focused and specific
AI Generator for Regex Patterns
Generate regular expression (regex) patterns using plain-language descriptions.
Instead of manually writing regex syntax, describe the format you want to validate and CSVBox will generate the regex pattern automatically.
Perfect for:
Email validation
Phone number formats
ZIP/postal codes
Product code validation
Password rules
Custom formatting patterns
Example Prompts
Phone Number Validation
Prompt
Generated Pattern
Email Validation
Prompt
Generated Pattern
ZIP Code Validation
Prompt
Generated Pattern
Product Code Format
Prompt
Generated Pattern
Best Practices
Keep Prompts Focused
Short, focused prompts produce better results than large multi-step instructions.
Good:
Less Effective:
Use Exact Column Names
Prefer:
Instead of:
Mention Formatting Rules
Examples:
YYYY-MM-DD10 digit phone numberuppercase product codecurrency with 2 decimals
Include Examples for Complex Logic
Adding examples improves accuracy significantly.
Example:
Testing Generated Code
Always review and test generated code before saving.
Recommended testing steps:
Review the generated output
Test with sample values
Test blank and null values
Verify edge cases
Confirm expected formatting
Ensure only intended fields are modified
Limitations
Current Limitations
Generates JavaScript functions and regex patterns only
External APIs and network requests are not supported
Browser APIs like localStorage and cookies cannot be used
Complex multi-step workflows may require multiple functions
Unsupported Operations
The AI cannot:
Add or remove rows
Modify your importer schema
Access external systems
Call third-party APIs
Access databases
Read files outside CSVBox
Perform actions outside the CSVBox execution environment
Common Issues
Generation Failed
Possible Causes
Network issue
Temporary server-side issue
Prompt too complex
Prompt too ambiguous
Solutions
Retry after a few seconds
Simplify the prompt
Make instructions more specific
Break large logic into smaller prompts
Generated Output Is Incorrect
Possible Causes
Missing formatting details
Ambiguous instructions
Missing edge cases
Unclear expected output
Solutions
Add input/output examples
Mention formatting rules explicitly
Specify null or blank value handling
Focus on one task at a time
Tips for Better Results
Use exact field names whenever possible
Keep prompts concise and specific
Mention edge cases such as blank values
Include examples for complex rules
Generate one function at a time
Review generated code before saving
Test thoroughly before production use
Security and Safety
Generated code runs within the CSVBox execution environment and follows CSVBox security restrictions.
Generated functions cannot:
access external systems
make network requests
access browser storage
modify importer configuration automatically
All generated code should be reviewed and tested before production use.
Last updated