DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:csv

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:csv [2016-04-15 14:49] LMS23plugin:csv [2024-02-10 21:12] (current) Aleksandr
Line 6: Line 6:
 email      : dokuwiki@cosmocode.de email      : dokuwiki@cosmocode.de
 type       : syntax type       : syntax
-lastupdate : 2016-04-15 +lastupdate : 2022-01-03 
-compatible : Hrun, Ponder Stibbons, Binky, Weatherwax, Adora Belle, Angua, Detritus+compatible : Hrun, Ponder Stibbons, Binky, Weatherwax, Adora Belle, Angua, Detritus, Greebo, Hogfather, Igor, Jack Jackrum
 depends    :  depends    : 
 conflicts  conflicts 
 similar    :  similar    : 
 tags       : csv, tables, file tags       : csv, tables, file
- 
  
 downloadurl: https://github.com/cosmocode/csv/zipball/master downloadurl: https://github.com/cosmocode/csv/zipball/master
Line 23: Line 22:
 ===== Description ===== ===== Description =====
  
-[[http://www.cosmocode.de/en/open-source/dokuwiki-plugins/|{{ http://cosmocode.de/static/img/dokuwiki/dwplugins.png?recache|A CosmoCode Plugin}}]] +[[http://www.cosmocode.de/en/open-source/dokuwiki-plugins/|{{ https://www.cosmocode.de/static/img/dokuwiki/dwplugins.png?recache|A CosmoCode Plugin}}]] 
-This is a simple [[plugins|plugin]] that will display CSV data in table form.  The data can either be inline between ''%%<csv>%%'' and ''%%</csv>%%'' + 
 +This is a simple plugin that will display CSV data in table form.  The data can either be inline between ''%%<csv>%%'' and ''%%</csv>%%''  
 <code> <code>
 <csv> <csv>
Line 32: Line 33:
 </csv> </csv>
 </code> </code>
 +
 or be read from a file in the media area using  or be read from a file in the media area using 
 +
 <code> <code>
 <csv namespace:test.csv></csv> <csv namespace:test.csv></csv>
 </code> </code>
 +
 You can also give an HTTP URL to a CSV file instead of an uploaded media file. You can also give an HTTP URL to a CSV file instead of an uploaded media file.
  
 If you are planning to use csv files in the media area, you will most likely need to include the .csv file extension in [[:mime|mime.local.conf]] so you can upload .csv files. Something like this should get you started: If you are planning to use csv files in the media area, you will most likely need to include the .csv file extension in [[:mime|mime.local.conf]] so you can upload .csv files. Something like this should get you started:
- +<code - mime.local.conf> 
-  csv     text/csv+csv     text/csv 
 +</code>
  
 The ''%%<csv>%%'' tag allows for additional options to be specified as well as a file reference. The ''%%<csv>%%'' tag allows for additional options to be specified as well as a file reference.
  
-^ Option                        ^ Description                                                                              ^ Default value  ^ +^ Option                                           ^ Description                                                                                                                                                                                                                               ^ Default value  ^ 
-| ''file=<filename>''           | where ''<filename>'' can be any ''<namespace:file.csv>'' or ''<http url>''               |  ''''          | +| ''file=<filename>''                              | where ''<filename>'' can be any ''<namespace:file.csv>'' or ''<http url>''. The ''file='' prefix is optional. Any option without a name is assumed to be the file name                                                                    |  ''''          | 
-| ''hdr_rows=//<n>//''          | Format the first //<n>// rows of data from the CSV as column headers                     |  ''1''         | +| ''hdr_rows=//<n>//''                             | Format the first //<n>// rows of data from the CSV as column headers                                                                                                                                                                      |  ''1''         | 
-| ''hdr_cols=//<n>//''          | Format the first //<n>// columns of each row as column headers                           |  ''0''         | +| ''hdr_cols=//<n>//''                             | Format the first //<n>// columns of each row as column headers                                                                                                                                                                            |  ''0''         | 
-| ''span_empty_cols=//[01]//''  | Create colspans for each empty (two adjacent commas) cell following a cell with content  |  ''0''         | +| ''span_empty_cols=//[01]//''                     | Create colspans for each empty (two adjacent commas) cell following a cell with content                                                                                                                                                   |  ''0''         | 
-| ''delim=//<char>//''          | The delimiter used between cells. Specify ''tab'' for a tab separated file.              |  '',''         | +| ''delim=//<char>//''                             | The delimiter used between cells. Specify ''tab'' for a tab separated file.                                                                                                                                                               |  '',''         | 
-| ''maxlines=//<n>//''          | limiting the result set to a certain number of rows                                      |  ''0''         | +| ''maxlines=//<n>//''                             | limiting the result set to a certain number of rows                                                                                                                                                                                       |  ''0''         | 
-| ''offset=//<n>//''            | skipping the given number of rows before output                                          |  ''0''         | +| ''offset=//<n>//''                               | skipping the given number of rows before output                                                                                                                                                                                           |  ''0''         | 
- +| ''filter[//<n>//][//t//]=%%"%%//<text>//%%"%%''  | Allows you to filter the rows.\\ \\ //<n>// is the column number you want to filter on. The first column is 1.\\ \\ //t// can either be an ''g'' for globbing or an ''r'' for regexpUse simple ''*'' in the globbing mode to find partial texts.  |                |
-Other options of the form <key>=<valueare possible but not used for displaying csv data yet.+
  
 Cells that include a comma as part of the data are expected to be contained between double quotes, which is the typical behaviour of most systems when exporting .csv files. Cells that include a comma as part of the data are expected to be contained between double quotes, which is the typical behaviour of most systems when exporting .csv files.
  
 Empty lines in the csv file or data are displayed as horizontal separators in the table. Empty lines in the csv file or data are displayed as horizontal separators in the table.
 +
 +Example for a table using a filter. This will look for values beginning with "P" in the third column. It will show the second line.
 +<code>
 +<csv hdr_rows=0 filter[3][g]="P*">
 +ABC,DEF,GHI
 +JKL,MNO,PQR
 +</csv>
 +</code>
 +
 +There is a second syntax mode to grab a **single value** from a CSV. This mode does not support inline CSV data!
 +
 +<code>
 +<csvval some.csv output=3,1>
 +</code>
 +
 +In addition to all the options supported in the ''<csv>'' syntax, you have to specify which column and (optionally) which row you want to output.
  
 ===== Download ===== ===== Download =====
  
-To install this plugin manually or through the [[plugin]] manager use the following URL:+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
   * https://github.com/cosmocode/csv/archive/master.zip   * https://github.com/cosmocode/csv/archive/master.zip
Line 71: Line 91:
 ==== Enhancement Considerations ==== ==== Enhancement Considerations ====
  
 +  * is it possible to add a download-button so that the csv-file could be directly downloaded (especially for inline-data)
   * might be nice to be able to have gridlines   * might be nice to be able to have gridlines
   * <del>Is it possible to put internal DokuWiki links in table cells to make them clickable?</del> see [[https://github.com/cosmocode/csv/issues/10|Issue #10]]   * <del>Is it possible to put internal DokuWiki links in table cells to make them clickable?</del> see [[https://github.com/cosmocode/csv/issues/10|Issue #10]]
Line 76: Line 97:
   * <del>Other DokuWiki formatting (**bold**, //italic//, __ul__, [[wp>Interwiki links]]) would be nice</del> see [[https://github.com/cosmocode/csv/issues/10|Issue #10]]   * <del>Other DokuWiki formatting (**bold**, //italic//, __ul__, [[wp>Interwiki links]]) would be nice</del> see [[https://github.com/cosmocode/csv/issues/10|Issue #10]]
   * Selection of rows and columns would be great e.g. rows=1,5,6,7 [[https://github.com/cosmocode/csv/issues/1|Issue #1]]   * Selection of rows and columns would be great e.g. rows=1,5,6,7 [[https://github.com/cosmocode/csv/issues/1|Issue #1]]
 +  * Setting of column width would be great
   * Justify right/align right   * Justify right/align right
   * Integration with the bootstrap theme -> header is not in the right colour. Global style of the table looks different than if you use the default syntax.   * Integration with the bootstrap theme -> header is not in the right colour. Global style of the table looks different than if you use the default syntax.
   * <del>Use of smileys (for example traffic light based on values)</del> see [[https://github.com/cosmocode/csv/issues/10|Issue #10]]   * <del>Use of smileys (for example traffic light based on values)</del> see [[https://github.com/cosmocode/csv/issues/10|Issue #10]]
 +  * read data from a csv-file stored at Windows Shares like [[wiki:syntax#windows_shares]]
 +  * Add row/column header via parameter
 +  * Make table sortable by different columns
 +
 ==== Use with a Google Docs Spreadsheet ==== ==== Use with a Google Docs Spreadsheet ====
  
plugin/csv.1460724572.txt.gz · Last modified: 2016-04-15 14:49 by LMS23

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki