emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] dates in a spreadsheet


From: Eric S Fraga
Subject: Re: [Orgmode] dates in a spreadsheet
Date: Thu, 18 Mar 2010 20:31:19 +0000
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 Emacs/23.1 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

On Wed, 17 Mar 2010 09:51:04 -0700, Josh Mattoon <address@hidden> wrote:
> 
> [1  <multipart/alternative (7bit)>]
> [1.1  <text/plain; ISO-8859-1 (7bit)>]
> Sure thing.  Basically I'd like the "date" column to be automatically
> calculated so that I can move things around, add extra days here and there,
> and not have to edit that column by hand.
> 
> | date      | location | activities    | notes                      |
> |-----------+----------+---------------+----------------------------|
> | 03-16 Tue | moon     | collect rocks |                            |
> | 03-17 Wed | mars     | terraform     | this might take a few days |
> | 03-18 Thu | earth    | breath air    |                            |
> 
> If I wanted to add an extra day on mars I could just enter a new row,
> recalculate the forumula, and the dates would be automagically updated.
> It's not such a big deal in a small example like this but I'm planning out a
> 3 week vacation with a fair number of destinations.  I'd like the day of
> week to display because some sites are closed on certain days.
> 
> It goes without saying that I've spent more time trying to figure this out
> than it would actually save so it's more about education at this point :)

Well, you can use the full power of both Emacs Lisp and Emacs Calc in
the org spreadsheet cells so the following works (although maybe it's
not quite as pretty as you would like...):

--8<---------------cut here---------------start------------->8---
| date number | date               | activity |
|-------------+--------------------+----------|
|      733850 | <Thu Mar 18, 2010> | swim     |
|      733851 | <Fri Mar 19, 2010> | run      |
|      733852 | <Sat Mar 20, 2010> | eat      |
#+TBLFM: address@hidden::$2='(calc-eval (concat "date(" $1 
")"))::@2$1='(calc-eval "date(now())");%d
--8<---------------cut here---------------end--------------->8---

The first column are date numbers which are then shown in text in the
second column.  the first date is currently set to "today" but this
could be any specific date by simply replacing "now()" by say
"date(3,18)" for 18 March.

I'm sure it can be done more expertly by others, of course, as I am
definitely not up to speed with calc.

Hope this helps.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]