Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't seem to modify .xls file #17

Closed
ghost opened this issue Nov 4, 2013 · 1 comment
Closed

Can't seem to modify .xls file #17

ghost opened this issue Nov 4, 2013 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 4, 2013

Hello!

I'm new to Clojure so I'm sure this is my fault but I'm just kind of too clueless to figure out what might be causing it.

Right now I have two simple functions for testing reading/writing for an excel file.

(defn a []
  (let [workbook (load-workbook "/home/ubikation/src/clojure/excel-test/products.xls")
        a1 (-> workbook (.getSheetAt 0) (.getRow 0) (.getCell 0))]
    (set-cell! a1 "foo")
    (println (.getStringCellValue a1))))

(defn z []
  (let [workbook (load-workbook "/home/ubikation/src/clojure/excel-test/products.xls")
        a1 (-> workbook (.getSheetAt 0) (.getRow 0) (.getCell 0))]
    (println (.getStringCellValue a1))))

The first one works, and prints "foo" but the second one will always return the initial value of the xls file.

Perhaps there is a non-local file bind? I'm not really sure what's going on or how to figure out what I'm doing wrong.

Sorry if this is the wrong location for this.

@ghost
Copy link
Author

ghost commented Nov 4, 2013

Sorry, turns out I forgot to save the workbook:

(defn a []
  (let [workbook (load-workbook "/home/ubikation/src/clojure/excel-test/products.xls")
        a1 (-> workbook (.getSheetAt 0) (.getRow 0) (.getCell 0))]
    (do (set-cell! a1 "foo")
        (save-workbook! "/home/ubikation/src/clojure/excel-test/products.xls" workbook))))

@ghost ghost closed this as completed Nov 4, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants