Skip to content

Enhance CSV export with configurable separator support and tests#524

Open
aradhyacp wants to merge 7 commits into
vercel:mainfrom
aradhyacp:enhance/csv-separator
Open

Enhance CSV export with configurable separator support and tests#524
aradhyacp wants to merge 7 commits into
vercel:mainfrom
aradhyacp:enhance/csv-separator

Conversation

@aradhyacp
Copy link
Copy Markdown
Contributor

Description

This PR enhances CSV export functionality by adding support for configurable separators. Previously, CSV export always used a comma (,), which caused compatibility issues in Excel for users in locales that expect semicolon (;) as the default separator. This change introduces flexibility and improves international compatibility.

It also introduces an "auto" mode that dynamically selects the appropriate separator based on the user's locale.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Refactoring (no functional changes)

Related Issues

Fixes #521
Closes #521
Related to #521

Changes Made

  • Added support for configurable CSV separators: ",", ";", "\t", and "auto".
  • Updated tableDataToCSV to dynamically use the selected separator instead of a hardcoded comma.
  • Implemented locale-based "auto" detection using Intl.NumberFormat.
  • Improved CSV escaping logic to respect the selected separator.
  • Added New test cases for semicolon, tab, and auto mode separator handling, including edge cases.
  • Ensured proper handling of quotes, newlines, and carriage returns in all separator modes.

Testing

  • All existing tests pass
  • Added new tests for the changes
  • Manually tested the changes

Test Coverage

  • Semicolon separator handling
  • Tab separator handling
  • Auto locale-based separator detection
  • Proper escaping for quotes, newlines, and separator characters
  • Regression coverage for default comma behavior

Screenshots/Demos

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have created a changeset (pnpm changeset)

Changeset

  • I have created a changeset for these changes

Additional Notes

This change is backward compatible and does not affect existing behavior unless csvSeparator is explicitly configured. Default behavior remains comma-separated CSV export.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 19, 2026

@aradhyacp is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configurable CSV separator for Excel locale compatibility

1 participant