.. _section_example_oechem_sdf2csv:

Exporting SD data to a CSV file
================================================================================

A program that converts the tags on an SD file to CSV format. The
output has on the first line the molecule title, followed by all the
unique tags found in the input database.

Example
--------------------------------------------------------------------------------

.. oe:language:: c++

   .. code-block:: console

      prompt > sdf2csv input.sdf output.csv

.. oe:language:: python

   .. code-block:: console

      prompt > sdf2csv.py input.sdf output.csv

.. oe:language:: java

   .. code-block:: console

      prompt > SDF2CSV input.sdf output.csv

.. oe:language:: csharp

   .. code-block:: console

      prompt > SDF2CSV input.sdf output.csv


Code
--------------------------------------------------------------------------------

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`sdf2csv.cpp <../../../../../sublibs/tklibs/oechem/examples/sdf2csv.cpp>`

   .. only:: oepdf

      .. oe:source:: sdf2csv.cpp
         :language: c++

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`sdf2csv.py <../../../../../wrappers/python/examples/oechem/sdf2csv.py>`

      .. literalinclude:: ../../../../../wrappers/python/examples/oechem/sdf2csv.py


   .. only:: oepdf

      .. oe:source:: sdf2csv.py
         :language: python

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SDF2CSV.java <../../../../../wrappers/java/examples/openeye/examples/oechem/SDF2CSV.java>`

   .. only:: oepdf

      .. oe:source:: SDF2CSV.java
         :language: java

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`SDF2CSV.cs <../../../../../wrappers/csharp/Csharp-Examples/OEChem/SDF2CSV.cs>`

   .. only:: oepdf

      .. oe:source:: SDF2CSV.cs
         :language: csharp


.. seealso::

   * :oe:func:`OEChem::OEGetSDData` function
   * :oe:func:`OEChem::OEGetSDDataPairs` function
