Re: Formulas in CSV files



(Apologies to Jody, who's getting this twice, but I didn't notice he had
the Reply-To: set in his message. And I've added a bit to the end anyway.)

On Thu, 23 Oct 2003 13:11:14 -0400, Jody Goldberg wrote:
On Thu, Oct 23, 2003 at 05:34:57PM +0100, Spencer Collyer wrote:
In an old version of Gnumeric (can't remember exactly which one, it
was the one that came with Mandrake 8.0, and was a 0.*.* one) I could
import a CSV file like the following:

---8<------Start File------8<---
1,"=date(2001,12,15)","=time(14,15,0)"
2,"=date(2001,12,15)","=time(14,45,0)"
---8<-------End File-------8<---

and it would correctly interpret the formulas embedded in the file,
and give me the actual formulas.

That was a bug.

A remarkably useful bug, then. I'd call it a feature myself. From a couple
of quick tests, both Excel (97) and OpenOffice.org (1.0.2) allow you to do
this.

What other options do I have if I want to include formulas (or at the very
least single function calls, as above) in text files to import into
Gnumeric? Other than performing the calculations myself to generate the
correct numbers, of course, which seems a bit backwards to me :).

Now, however, with Gnumeric 1.0.12 under SuSE Pro 8.2, when I import
such a file, it reads the formulas as strings. If I delete the "'"
marker at the start of them then the formula works correctly, but
obviously this is sub-optimal, and, for big files, a real non-starter.

We could probably add a new format type 'Expression' that would
attempt to parse the string as an expression if possible.  File an
enhancement request and we'll consider it for 1.3.x.

OK, sounds like a reasonable workaround. I've never done a feature
request, and can't find anything on the website about them - any guidance
on doing one?

But a thought occurs to me - couldn't you just send any string that starts
with '=' to the expression parser anyway (I assume this was what was
happening in the old version I mentioned), and if it returned a valid
response use that, otherwise just use the string? This wouldn't be that
different to entering an expression on the input bar, except instead of
giving an error, you just use the original string?

Cheers

S>

-- 
<<< Eagles may soar, but weasels don't get sucked into jet engines >>>
11:46am up 24 days 19:27, 12 users, load average: 0.00, 0.03, 0.07
Registered Linux User #232457



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