The spreadsheet package

[ Tags: bsd3, data, library, text ] [ Propose Tags ]

Read and write spreadsheets from and to files containing comma separated values (CSV) in a lazy way. Reading from other source than plain Strings could be easily added.

If you install this package by

cabal install -fbuildExamples

then the example program csvreplace is compiled and installed, too. This program fills a template text using data from a CSV file. For similar (non-Haskell) programs see cut, csvfix, csvtool.

Related packages:

[Skip to Readme]


Versions 0.1, 0.1.1,, 0.1.2,, 0.1.3,,,,,
Dependencies base (>=1.0 && <5), explicit-exception (==0.1.*), spreadsheet, transformers (>=0.2 && <0.6), utility-ht (>=0.0.2 && <0.1) [details]
License BSD3
Author Henning Thielemann <>
Maintainer Henning Thielemann <>
Category Data, Text
Home page
Source repository head: darcs get
this: darcs get --tag
Uploaded Thu Jul 13 07:34:25 UTC 2017 by HenningThielemann
Distributions LTSHaskell:, NixOS:, Stackage:, Tumbleweed:
Executables csvreplace
Downloads 2375 total (29 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-07-13 [all 1 reports]
Hackage Matrix CI





Build example executables


Choose the new smaller, split-up base package.


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

For package maintainers and hackage trustees

Readme for spreadsheet-

[back to package description]

Example: csvreplace

If you build the package with the Cabal flag -fbuildExamples then the program csvreplace will be built. It allows you to replace placeholders in a template file according to the columns of a CSV file. E.g. given a file template.txt with content


and names.csv with content


the call

csvreplace template.txt <names.csv

produces the output

Name: Georg Cantor
Born: 1845
Name: Haskell Curry
Born: 1900
Name: Ada Lovelace
Born: 1815

You may also generate one file per CSV row in the following manner:

csvreplace --multifile=FIRSTNAME-SURNAME.txt template.txt <names.csv

Character Encoding

For simple replacement of parts of the text we would not need to decode the input texts and thus we would not need to know the used encoding scheme. Essentially, we would only require that both CSV and template file employ the same character encoding.

However, it is not as simple as that. We need to decode the structure of the CSV file. In multi-file mode we also need to generate proper file names. Both requirements force us to decode both CSV and template file. For the de- and encoding we use the default locale encoding.

If you want essentially a byte-by-byte replacement and you assert that all files are in the same encoding where the commas and quotation marks are compatible with ASCII then you can set the encoding locally to a complete 8-bit encoding like latin1 as in:

LANG=de_DE csvreplace --multifile=FIRSTNAME-SURNAME.txt template.txt <names.csv