Skip to content

Instantly share code, notes, and snippets.

@qrilka
Created April 11, 2016 05:59
Show Gist options
  • Save qrilka/15ce862e18fd1d13f58e1677c3f307f3 to your computer and use it in GitHub Desktop.
Save qrilka/15ce862e18fd1d13f58e1677c3f307f3 to your computer and use it in GitHub Desktop.
{-# LANGUAGE OverloadedStrings #-}
import Data.ByteString.Lazy as L hiding (putStrLn)
import Codec.Xlsx
import Control.Lens
import Data.Time.Clock.POSIX (getPOSIXTime)
main = do
bs <- L.readFile "test.xlsx"
let
xlsx0 = toXlsx bs
value = xlsx0 ^? ixSheet "4_pooli" . ixCell (2,2) . cellValue . _Just
ct <- getPOSIXTime
putStrLn $ "Cell B2 contains " ++ show value
let
xlsx = xlsx0 & atSheet "sheet" . _Just . cellValueAt (2,2) ?~ CellText "New text"
L.writeFile "example.xlsx" $ fromXlsx ct xlsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment