How to run an sql query on an OpenOffice/LibreOffice spreadsheet from command line? - sql

Well,
The title pretty much says it all. I have a set of ODS spreadsheets and I want to run some SQL queries over these spreadsheets and save the result on CSV files.
I know I can do that from the GUI, but I need to be able to do it from a batch file that will be run on a regular basis.
Solutions that make use of OpenOffice/LibreOffice Basic are acceptable, as well as solutions that require the use of some (free) plug-in.
Thanks in advance.

You could first convert .ods files into .csv files and do what you have to do on .csv files (insert in a real database, read it as plain text, etc.).
libreoffice --convert-to csv *.ods

Related

Can I export my SQL code (queries) to my computer as a .sql document?

I was asked to analyze a dataset in BigQuery (never used it until now) and I need to export my code as .sql documents. Is there a way to do this?
Big Query lets you save the queries on the cloud so you can use them later, as you may have noticed.
But if you really want to store them as files in your computer, you can always copy the code, paste them in a notepad and them save it as .sql, which can then be imported in platforms like PostgreSQL, etc.
Big Query doesn't allow you to load .sql files, though.

VBS or VBA for Multiple Excel Files?

Here is what I need to do:
I have around 1000 folders, within each of these folders is an excel file that I need to reformat (all the excel files are similarly formatted), I imagine the actual programming part is quite easy but that is besides the point. If I need to run a script on each of these excel files, should I use VBA or VBS?
As far as I understand, VBS can be run from the command line and doesn't require any Excel files to be open but VBA does require Excel to be open in order to run the script but that seems counter intuitive since I need to run a script on not just one workbook but a thousand.
Any help will be appreciated.
Many thanks.
Edit: I should say explicitly, I am trying to convert around 1000 CSV files to XLSX, I have tried python packages such as OpenPYXL and XLSXwriter but they are just terribly slow - it takes around 5 minutes per file.
I suggest you to use Python with the openpyxl package to implement your idea. The openpyxl package is intuitively easy to use, while Python's flexibility will allow you to get the job done in short term.

Export from .xls to .sql / creating sql queries

Okay guys, I've been having this problem for a few weeks now and I'm getting no-where with it. I have OpenOffice and regular Office softwares. Both produce flawed .csv files, or at least phpMyAdmin can't read neither of these. Yes, I've been trying to change server's settings of uploading, etc. I also tried to contact my web hosting service and they claimed that all the .csv files I've produced are flawed.
Anyway, I'm looking for a way to convert .xls table to SQL. Most of the softwares out there cost money that I don't have. Furthermore, I've seen PHP systems that do just that, so I know this is possible.
No need converted to. sql, you can import directly with phpmyadmin or using tools like navicat for mysql in phpmyadmin go to the option to import, find the file, select the file type (csv or csv loaddata), in part below defines the column separator (if you do not know which opens the file with notepad)
if a very large file using navicat.
Flawed is "defective"?. I assume you have problem with excel, maybe you have defined the same column separator for separating thousands or decimals, use openoffice to open the file

Import PDF Fields into Database

I'm trying to import fields from a fill-able PDF into a sql databse.
I can't seem to find an answer online:
What's the best way to import/read data from pdf files?
Insert a PDF file into Core Data?'
http://www.utteraccess.com/forum/Import-Fillable-Pfd-Data-t1971535.html
So I'm wondering does anyone know how to extract data from a fill-able PDF into a database(or excel from which it can be imported into a database)
Thanks
Data from fillable pdf's can be exported into an .FDF file, which is a text file. pdftk is a command-line utility that will allow you to extract the data programmatically. You will then need to write a custom parser to pull the data out of the .FDF file.
It won't be a lot of fun, but it should be do-able.
You can use pdftk. I used it and it's great works like a charm. Lot's of coding though. You can get back at me if you need any help

Generating Excel file from Cocoa (iPhone app)

I'd like to offer the possibility for users of my app to export to Excel. I don't ever need to read Excel files.
The three ways I know right now is to
make a CSV file, which isn't too great as I'd like to have some custom formatting in the spreadsheet
make an XML file that I don't think people'd recognize as an Excel file
make a template xlsx file, unzip it in the app, do a lot of search-replacing in the files and then zip it back up again
Are there other alternatives? I'm not sure how supported .xlsx files are, and that seems like very much work. Are there any frameworks out there I can lean on, that perhaps even make old-school .xls files?
Cheers
Nik
Some options for you to consider:
1) You may be able to use ooxml http://en.wikipedia.org/wiki/Office_Open_XML_file_formats. You may need the "office compatibility pack" on computers with excel 2003 or lower http://go.microsoft.com/?linkid=5754865.
2) Excel 2000 uses the BIFF file format: http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBcQFjAA&url=http%3A%2F%2Fsc.openoffice.org%2Fexcelfileformat.pdf&ei=iDx0TKOhBIqmnQfckKy7CQ&usg=AFQjCNE2w4xyFSoKmvKdsa7O9TMqynYpbA (pdf). You may be able to create simple documents from the spec or based on other info on the web.