I'm looking for a library that will transform text files in one format into text files in another format. Example formats are XLS, XML, JSON, TSV, CSV, and various forms of fixed field length files.

I have a standard input format and a standard output format. Often, input files are in a different format and need to be transformed. Occasionally I'll also need to transform the output file before it can be used. These seems like a fairly common use case, so I don't want to reinvent the wheel if I can avoid it. Either this isn't as common as I think it is, or my Google-fu is failing me on this one. Most of the results are either online converters or single source/target converters (only CSV to JSON).

C# is preferable, although command-line option that I could invoke would work too. Open source or free is preferable, but all options are welcome.

P.S. I am aware that several ETL solutions do this sort of thing. I'm not looking for SSIS or Talend. I'm looking for a library or at least a command-line tool that I can invoke programmatically.

  • I just found this stackoverflow.com/questions/62077/…. But the answers there don't look like libraries. Jul 16, 2014 at 22:30
  • 1
    If you can manage some script/programming than perl is excellent for such task (having CPAN modules for parse & write JSON, XML, CSV and nearly all common file formats. Python should be OK too, but I didn't use it.
    – clt60
    Jul 18, 2014 at 22:24
  • I’m not sure if it’s the right tool, but Pandoc is a command-line tool (and a Haskell library) that can convert between markup formats. It doesn’t support your formats, but you can add new formats with Lua.
    – unor
    Aug 19, 2014 at 9:56
  • I don't know how you can map JSON (a tree stucture) to CSV files, unless you map each node to a row, and have rows "point" (by containing row numbers) too other rows. I don't know how you can easily process such a CSV file.
    – Ira Baxter
    Apr 14, 2015 at 4:07

2 Answers 2


For transforming XML, you should simply use any implementation of XSLT. (If you have a MS system, "msxsl" is already on your disk)

It should take only a few lines of XSLT to produce equivalent JSON. XSLT won't work on JSON but what it does with XML is pretty spectacular. If that isn't enough you can add some JavaScript goo to XSLT scripts to help.

In fact, if you already have an XML version of the file, you should be able to use XSLT to produce any of the other desired formats. So by choosing XML as your "canonical" representation, you'd only need one tool.


I don't know of any perfect options. However I do have one option that I like for CSV/Excel/JSON/ARFF to CSV/JSON/ARFF conversion. It is relatively easy to extend as well (though I haven't done so personally).

It is the OpenKnowledge Foundation Lab's DataConverters. It is python based but it does have a CLI option. (though IIRC it does require python installed for that as well).

Problems I can see for your requirements is lack of support for XML and inability to write to XLS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.