ldap-csvexport.pl - a tool to easily and quickly export LDAP entries to CSV files
What's that?
It is a small tool written in perl that allows you to easily export arbitary LDAP entries to a flat
CSV (comma separated values) file. The CSV file can then be used to synchronize other databases or to
get Lists of data. CSV files can be read by applications like OpenOffice Calc
or Microsoft Excel.
LDAP is a protocol used to communicate with directory servers such as OpenLDAP or Microsoft ActiveDirectory.
Directory servers are database servers that store the data hierarchical instead of a tabular representation.
This makes them the ideal choice for central user management, but also other demands.
What can it do?
As said above, it exports entries to csv files. It does that by performing a search operation on the server and dumping
attribute values of entries to STDOUT. Most commonly, STDOUT will be simply redirected to a file, but you can of course
also pipe the csv-data to some other application (like a perl script doing some magic), which makes that quite powerful.
Feature list (main features):
- LDAPv3 support with paging allows to query arbitary LDAP servers in an efficient manner
- Full LDAP filter support allows you to select any entries you wish to export
- Full control of CSV output allows you to define the field separator and value quote string.
It is possible to supply strings, not only single characters!
- Supports chained lookups so it is easy to assemble data referenced with dn-links (like the managers telephone number: "
manager.telephoneNumber
")
- Easy counting of number of attribute values, like "how many members do my groups have?"
- Writing csv data to STDOUT allows you to postprocess the exported data easily and in a flexible manner
- Platform independ because it is wiritten in perl - perl is available for many platforms and many
operating systems, including Microsoft Windows!
How does it work?
It is very simple since it runs from command line. Just download it and call it without
parameters. This will give you all options that can be set.
Calling it with the "-h" parameter even gives some more advice.
Additionally, you can find a more detailed documentation in the release package.
Example? sure!
This will export the groups, members count and members common name from the public LDAP at forumsys.com:
ldap-csvexport.pl -H 'ldap://ldap.forumsys.com:389/dc=example,dc=com?ou,[#]uniqueMember,uniqueMember.uid?sub?(objectClass=groupOfUniqueNames)'
"ou";"uniqueMember";"uniqueMember.uid"
"mathematicians";"5";"euclid|riemann|euler|gauss|test"
"scientists";"4";"einstein|galieleo|tesla|newton"
"italians";"1";"tesla"
Description: ou
requests the name of the group, [#]uniqueMember
fetches the members and counts them and finally uniqueMember.uid
retrieves each members uid
attribute (chained lookup). The whole lookup is specified via a RFC-2255 compliant LDAP URL (as alternative to other available command line options).
The four lines following the command is simply the CSV output, your desired data.
Where can i download this cool exporter?
You can download the latest development version from svn:
svn co https://ldap-csvexport.svn.sourceforge.net/svnroot/ldap-csvexport ldap-csvexport
Or just download the latest file release from the project page at sourceforge!
Where can i report bugs or request new Features? What about project news and screenshots?
The Sourceforge project page hosts all that. Please
refer to the page for latest infos and for our forums and bug/features tracker.