LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 10: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, 10: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, 06: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, 06:59 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

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



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 01:09 PM
Spreadsheet. Create chart from cells apart from each other Ferus85 Linux - Software 1 05-06-2009 09:16 AM
BASH: instad of echo-ing, I just want to assing to a bash variable... how?? rylan76 Linux - Newbie 9 11-28-2008 08:46 AM
Console/ bash: Post your script to retrieve and echo the weather/temperature ? frenchn00b Linux - General 1 02-16-2008 09:45 AM
Bash Script, no new line for echo command jorisb Linux - General 5 11-05-2005 12:08 AM

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

All times are GMT -5. The time now is 07:31 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
Open Source Consulting | Domain Registration