Re: Feasibility of system() plugin?



Leigh Smith wrote:

I've just got up to speed on gnumeric on MacOS X after converting some spreadsheets from sc. I'm considering writing a gnumeric plug-in to suit my needs, but wanted to check that the functionality isn't already in gnumeric and I've somehow missed it.

I'd like to retrieve market data and have the share prices appear in cells that can then be used for calculations. Recalculating the sheet would cause new values to be fetched.

The easiest way I can see that would have some value to everyone else would be to implement a function SYSTEM() that would take a string of the command to be executed and return a numeric value. Therefore =SYSTEM("get_shares ORCL") would evaluate to the current share price. get_shares is just a shell script I have that can grab the values using curl and print the share price on stdout and do some caching of data fetches.

If I'm not already reproducing a function that exists (I don't want to just import a CSV file each time the data changes), I'm happy to write a plugin,
 (the plugin API looks pretty straightforward) and I'll contribute it back.
Obviously I could do this via the Python plugin, but it seems a bit of overkill to use python just to execute an external command. Strictly speaking I could define a number of functions that return different formats of data, but the one that scans the output for the first float seems the most useful initially.

Thoughts?


I would be greatly concerned about security issues. This function would likely be executed upo loading of a possible untrusted worksheet...

Andreas




--
Prof. Dr. Andreas J. Guelzow
http://www.math.concordia.ab.ca/aguelzow




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