Sublime DataConverter
This Sublime Text package converts csv files to various other formats. It's been adapted from the wonderful Mr. Data Converter.
After installing, you'll find commands look like DataConverter: to foo in the Command Palette. DataConverter will convert a selection or multiple selections. If nothing is selected, the entire document is converted.
Examples
Turn this:
NAME,VALUE,FRUIT,DATE
Alice,10,Apple,"Sep. 12, 2012"
Bob,11,Blueberry,"Sep. 13, 2012"
Chris,12,Orange,"Sep. 14, 2012"
into this (Ruby):
[{"NAME"=>"Alice", "VALUE"=>10, "FRUIT"=>"Apple", "DATE"=>"Sep. 12, 2012"},
{"NAME"=>"Bob", "VALUE"=>11, "FRUIT"=>"Blueberry", "DATE"=>"Sep. 13, 2012"},
{"NAME"=>"Chris", "VALUE"=>12, "FRUIT"=>"Orange", "DATE"=>"Sep. 14, 2012"}];
or this (JSON):
[
{"FRUIT": "Apple", "NAME": "Alice", "VALUE": "10", "DATE": "Sep. 12, 2012"},
{"FRUIT": "Blueberry", "NAME": "Bob", "VALUE": "11", "DATE": "Sep. 13, 2012"},
{"FRUIT": "Orange", "NAME": "Chris", "VALUE": "12", "DATE": "Sep. 14, 2012"}
]
Formats supported
- ActionScript
- ASP
- HTML tables
- Gherkin
- JIRA (Atlassian Confluence)
- JSON
- JSON (array of columns)
- JSON (array of rows)
- Javascript object
- MySQL
- Perl
- PHP (two formats)
- Python (list of dicts)
- Python (list of lists)
- Ruby
- text table
- Wiki markup
- XML
- XML (property list)
- XML for data-driven Adobe Illustrator
- YAML
Configuration
Check out DataConverter.sublime-settings
for a documented list of options.
Installation
With Package Control
If you have Package Control installed, you can install DataConverter from within Sublime Text 2. Open the Command Palette and enter "Package Control: Install Package", then search for DataConverter.
Without Package Control
Clone the repository into your Sublime Text 2 packages directory:
git clone git://github.com/fitnr/SublimeDataConverter.git
Without Package Control or Git
Click Download Zip
above to download the package. Unzip it, rename the folder "DataConverter" and move it into your Sublime Text 2 packages directory (Preferences > Browse Packages in the application menu).
Problems?
Contributing
Pull requests with additional formats are encouraged. The YAML converter is well-commented as an introduction to how the package works.