Page 1 of 1

Programatically export to remote database

PostPosted: Thu Nov 21, 2019 1:44 pm
by keneso
Hi

I have a website (Php/MySql), and need to import data to a database table, as of now, there is an import page on the web application, and works fine by selecting and importing as .csv
My question is if it is possible to do so from my local machine programatically (or manually?) whenever I update the .csv file directly from calc without going to the import page thru the browser, basically by clicking an "upload button" within calc.
If yes, how?

Thank you.

Re: programatically export to remote database

PostPosted: Thu Nov 21, 2019 2:34 pm
by Villeroy
viewtopic.php?f=21&t=95587

Normally, you do not need any kind of office suite or spreadsheet application to import csv into a database. csv is a database exchange format. csv has nothing to do with spreadsheets.

Re: programatically export to remote database

PostPosted: Thu Nov 21, 2019 2:45 pm
by robleyd
From what I read in OP's question, they want the exported CSV file to be somehow uploaded to a web page that will then process the CSV into a MySQL database.

Unfortunately the question doesn't tell us how the web page functions; for example does it require selecting a file to upload for processing, or perhaps the CSV is pasted into a textarea, or...

I suspect this might be done as a macro using an external language, e.g. Python but given the lack of detail it isn't possible to say. It is also possible that the time to produce such a tool probably wouldn't be offset by savings in upload times, especially if the OP is not familiar with programming.

Re: programatically export to remote database

PostPosted: Thu Nov 21, 2019 3:05 pm
by keneso
Thank you for your replies.

Sorry for the confusion, please let me detail it more.

The workflow is like this:
Data is created on a spreadsheet, and then saved as .csv to be imported (the file) to the database.
Right now the import is done by the webpage (and works fine) thru an upload file field/button i.e. select file, click import.

Problem is the import might occur several times a day, and going each time to the page to select, and upload could become tedious, and time consuming, whereas if we could automate the process, and having the spreadsheet (in .csv) to connect each time is updated, and saved (without the need to open browser, and going to the import page), would help a lot.

Re: programatically export to remote database

PostPosted: Thu Nov 21, 2019 3:11 pm
by Villeroy
With my solution you don't need the csv. Connect a Base document to your database, prepare a spreadsheet with the named cells and call the macro to update the database table with spreadsheet data.

Re: programatically export to remote database

PostPosted: Thu Nov 21, 2019 5:17 pm
by keneso
Villeroy wrote:With my solution you don't need the csv. Connect a Base document to your database, prepare a spreadsheet with the named cells and call the macro to update the database table with spreadsheet data.


My bad, I had missed the link in your first post.
I'll try, and see what I can do; will report back in next days.

Thank you.