LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Echo cells from a spreadsheet in BASH script (https://www.linuxquestions.org/questions/linux-software-2/echo-cells-from-a-spreadsheet-in-bash-script-745318/)

General 08-05-2009 10:35 AM

Echo cells from a spreadsheet in BASH script
 
I have a spreadsheet. Made in OpenOffice.org Calc. Really simple. No formulas.

I need to write a script in Bash that can access that information. That will make some LaTeX code with the values from the cells mixed in...

So I need some way for Bash to get information from the spreadsheet. Is there a simple spreadsheet file format I can export this to? What application can I put in a Bash script that will simply echo, for instance, the contents of A4.

What should I look for?

pwc101 08-05-2009 10:50 AM

Quote:

Originally Posted by General (Post 3632424)
Is there a simple spreadsheet file format I can export this to?

Save it as a CSV file (Comma Separated Values) and it'll become a text file with the columns of the spreadsheet separated by commas (hence the name! ;)). Parsing that in awk to extract the value from the 4th row in the first column (A4) is a doddle...

General 08-05-2009 06:50 PM

Quote:

Originally Posted by pwc101 (Post 3632448)
Save it as a CSV file (Comma Separated Values) and it'll become a text file with the columns of the spreadsheet separated by commas (hence the name! ;)). Parsing that in awk to extract the value from the 4th row in the first column (A4) is a doddle...

Great, thanks!

jlinkels 08-05-2009 06:59 PM

When I had to do this some years ago I created a macro in OOCalc and called the macro in the document from the command line. Office didn't even have to start in the GUI. After that I used awk to retrieve the values.

Here is a list with threads describing this process:
http://www.oooforum.org/forum/viewtopic.phtml?t=12922
If you read a few of these threads you'll understand what the principle is, choose the simplest one for your needs.

I hope that in the mean time better methods have come up. OOBasic is incomprehensible, error-prone, zero debug possibilities stops working from one version to the next. That is the reason why I cannot point you to a working method, because I don't remember which ones worked and which were broken.

jlinkels


All times are GMT -5. The time now is 05:01 AM.