Git Product home page Git Product logo

catmandu-exporter-table's Introduction

NAME

Catmandu::Exporter::Table - ASCII/Markdown table exporter

STATUS

Build Status Coverage Status Kwalitee Score

SYNOPSIS

With catmandu command line client:

echo '{"one":"my","two":"table"} {"one":"is","two":"nice"}' | \ 
catmandu convert JSON --multiline 1 to Table
| one | two   |
|-----|-------|
| my  | table |
| is  | nice  |

catmandu convert CSV to Table --fields id,name --columns ID,Name < sample.csv
| ID | Name |
|----|------|
| 23 | foo  |
| 42 | bar  |
| 99 | doz  |

In Perl scripts:

use Catmandu::Exporter::Table;
my $exp = Catmandu::Exporter::Table->new;
$exp->add({ title => "The Hobbit", author => "Tolkien" });
$exp->add({ title => "Where the Wild Things Are", author => "Sendak" });
$exp->add({ title => "One Thousand and One Nights" });
$exp->commit;

| author  | title                       |
|---------|-----------------------------|
| Tolkien | The Hobbit                  |
| Sendak  | Where the Wild Things Are   |
|         | One Thousand and One Nights |

DESCRIPTION

This Catmandu::Exporter exports data in tabular form, formatted in MultiMarkdown syntax.

The output can be used for simple display, for instance to preview Excel files on the command line. Use Pandoc too further convert to other table formats, e.g. latex, html5, mediawiki:

catmandu convert XLS to Table < sheet.xls | pandoc -t html5

By default columns are sorted alphabetically by field name.

CONFIGURATION

Table output can be controlled with the options fields, columns, widths, and condense as documented in Text::MarkdownTable.

  • file

  • fh

  • encoding

  • fix

    Standard options of Catmandu:Exporter

  • condense

    Write table in condense format with unaligned columns.

  • fields

    Field names as comma-separated list or array reference.

  • columns

    Column names as comma-separated list or array reference. By default field names are used as column names.

  • header

    Include header lines. Enabled by default.

  • widths

    Column widths as comma-separated list or array references. Calculated from all rows by default. Long cell values can get truncated with this option.

  • schema

    Supply fields and (optionally) columns in a JSON Table Schema as JSON file or hash reference having the following structure:

      {
        "fields: [
          { "name": "field-name-1", "title": "column title 1 (optional)" },
          { "name": "field-name-2", "title": "column title 2 (optional)" },
          ...
        ]
      }
    

METHODS

See Catmandu::Exporter

SEE ALSO

This module is based on Text::MarkdownTable.

Similar Catmandu Exporters for tabular data include Catmandu::Exporter::CSV, Catmandu::Exporter::XLS, and Catmandu::Exporter::XLSX.

catmandu-exporter-table's People

Contributors

jorol avatar nichtich avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.