LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-05-2009, 11:35 AM   #1
General
Member
 
Registered: Aug 2005
Distribution: Debian 7
Posts: 526

Rep: Reputation: 31
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?
 
Old 08-05-2009, 11:50 AM   #2
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Quote:
Originally Posted by General View Post
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...
 
Old 08-05-2009, 07:50 PM   #3
General
Member
 
Registered: Aug 2005
Distribution: Debian 7
Posts: 526

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by pwc101 View Post
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!
 
Old 08-05-2009, 07:59 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,191

Rep: Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039Reputation: 1039
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make DOS' echo on in bash script? Dims Linux - Newbie 2 06-01-2009 02:09 PM
Spreadsheet. Create chart from cells apart from each other Ferus85 Linux - Software 1 05-06-2009 10:16 AM
BASH: instad of echo-ing, I just want to assing to a bash variable... how?? rylan76 Linux - Newbie 9 11-28-2008 09:46 AM
Console/ bash: Post your script to retrieve and echo the weather/temperature ? frenchn00b Linux - General 1 02-16-2008 10:45 AM
Bash Script, no new line for echo command jorisb Linux - General 5 11-05-2005 01:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration