On 13 Jun 11:37, Richard Parsons wrote:
Brett Parker iDunno@sommitrealweird.co.uk wrote:
So, what I'd be looking at is:
Table : Brewery Columns: id name description Table : Beer Columns: id brewery_id name description
That looks much better to me. Now you need to write some sql that creates that database. Have a look at the sqlite documentation for that.
Thus having a one to many relationship between brewery and beer, storing the id of the brewery in the beer means that you can change the fields of the brewery (in the event of it being renamed, or the description changing, etc), and that applies immediately to all beers of the brewery.
This is normal database normalisation.
That's a mouthful. :)
Now back to your original question. Can you convert the spreadsheet to csv? That will make it easier to parse. Perhaps then give the first few lines of that csv, so we can help with parsing it.
Also, which scripting language do you want to do this in? Bash is probably easiest for me. Python will do it easily enough. Perl can do it, but I don't know perl (others on the list probably do). Someone suggested awk: that would probably be neater that bash/python, but I'm sure not as experienced in it. I'm sure there's lots more options (ruby etc).
I would *never* suggest parsing csv in bash. Ever. Python's csv module is lovely, and perl's DBD::CSV is fine. Awk hasn't got a csv parser, and reinvention of wheels is bad :)
It appears that there are python modules for interactive with openoffice, but I've not played with them yet, so I can't recommend them. Certainly previously when faced with a similar situation I've gone the csv and python route because it was the path of least resistance (and I was in a hurry...)