Skip to main content
The AI Function Generator in CSVbox helps you create JavaScript functions and regex patterns without writing code manually. Describe what you want in plain English, and CSVbox generates compatible logic for your importer automatically. AI generation is available across:
  • Validation Functions
  • Virtual Columns
  • Data Transforms
  • Regex Column Type
Use it to build advanced import logic faster, reduce manual coding, and simplify complex validation or transformation workflows.

How it works

1

Open a supported editor

Open a supported editor in CSVbox.
2

Click Generate

Click the Generate button.
3

Describe the logic you want

Describe the logic in plain language. CSVbox generates compatible JavaScript or regex code.
4

Review the generated output

Review the output. All generated code remains fully editable before saving.
5

Insert and save the function

Insert the code and save the function.

Supported features

Writing better prompts

The quality of the generated output depends heavily on how clearly you describe the requirement. 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

Generate validation rules from plain-language descriptions instead of writing JavaScript validation logic by hand. Useful for:
  • Email validation
  • Phone number validation
  • Date validation
  • Required field checks
  • Cross-column validation
  • Business-specific validation rules

Example prompts

Email validation

Prompt
Expected behavior
  • "user@example.com" → valid
  • "user@" → invalid

Phone number validation

Prompt
Expected behavior
  • "(555) 123-4567" → valid
  • "123-456" → invalid

Date validation

Prompt
Expected behavior
  • "2023-12-25" → valid
  • "12/25/2023" → invalid

Cross-column validation

Prompt
Expected behavior
  • start_date="2023-01-01", end_date="2023-12-31" → valid
  • start_date="2023-12-31", end_date="2023-01-01" → invalid

Validation prompt tips

For better validation results:
  1. Start with action words such as:
    • validate
    • ensure
    • verify
    • require
    • check
  2. Mention exact field names.
  3. Describe the validation condition clearly.
  4. Include valid and invalid examples for complex rules.
  5. Mention how blank or null values should behave.

AI generator for virtual columns

Generate computed or derived columns from natural-language instructions. Instead of writing JavaScript logic by hand, describe what the virtual column should calculate or return. Useful for:
  • Combining fields
  • Calculated totals
  • Derived statuses
  • Formatting dates
  • Extracting values
  • Building custom labels

Example prompts

Full name column

Prompt
Expected behavior
  • "john" + "DOE" → "John Doe"

Total price calculation

Prompt
Expected behavior
  • quantity=5, unit_price=10.50 → 52.50

Date formatting

Prompt
Expected behavior
  • "12/25/2023" → "December 25, 2023"

Status generation

Prompt
Expected behavior
  • Past date → "Overdue"
  • Within 7 days → "Due Soon"
  • Future date → "On Track"

Virtual column prompt tips

  1. Mention which fields should be used.
  2. Describe the expected output clearly.
  3. Specify formatting rules.
  4. Include examples for calculated logic.
  5. Focus on one generated field at a time.

AI generator for data transforms

Generate data transformation logic from plain-language instructions to clean, normalize, or reformat imported data automatically. Useful for:
  • Text normalization
  • Formatting cleanup
  • Phone number cleanup
  • Date conversion
  • Value mapping
  • Row transformations

Example prompts

Email standardization

Prompt
Expected behavior
  • " John.Doe@Example.COM " → "john.doe@example.com"

Phone number cleanup

Prompt
Expected behavior
  • "(555) 123-4567" → "5551234567"

Full name generation

Prompt
Expected behavior
  • "john" + "DOE" → "John Doe"

Date formatting

Prompt
Expected behavior
  • "12/25/2023" → "2023-12-25"

Data transform prompt tips

  1. Start with action words like:
    • convert
    • remove
    • replace
    • format
    • normalize
    • combine
  2. Specify the target column.
  3. Clearly describe the final output format.
  4. Include sample input/output values for complex transforms.
  5. Keep transformations focused and specific.

AI generator for regex patterns

Generate regular expression (regex) patterns from plain-language descriptions. Instead of writing regex syntax by hand, describe the format you want to validate and CSVbox generates the pattern automatically. Useful 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-DD
  • 10 digit phone number
  • uppercase product code
  • currency with 2 decimals

Include examples for complex logic

Adding examples improves accuracy significantly. For example:

Testing generated code

Always review and test generated code before saving. Recommended testing steps:
  1. Review the generated output.
  2. Test with sample values.
  3. Test blank and null values.
  4. Verify edge cases.
  5. Confirm expected formatting.
  6. 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 can’t be used.
  • Complex multi-step workflows may require multiple functions.

Unsupported operations

The AI can’t:
  • 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

  1. Use exact field names whenever possible.
  2. Keep prompts concise and specific.
  3. Mention edge cases such as blank values.
  4. Include examples for complex rules.
  5. Generate one function at a time.
  6. Review generated code before saving.
  7. Test thoroughly before production use.

Security and safety

Generated code runs within the CSVbox execution environment and follows CSVbox security restrictions. Generated functions can’t:
  • Access external systems
  • Make network requests
  • Access browser storage
  • Modify importer configuration automatically
Review and test all generated code before production use.