dbTalk Databases Forums  

Excel to MySQL table

comp.databases.mysql comp.databases.mysql


Discuss Excel to MySQL table in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joseph Hesse
 
Posts: n/a

Default Excel to MySQL table - 07-07-2011 , 02:42 PM






I currently convert an excel file to a mysql table in the following way.

Open excel and delete not needed columns.
Select date columns and format them to YYYY-MM-DD.
Export to a csv file.
Edit the csv file to remove the first line.
Load the csv file to a mysql table.

I would appreciate it if someone can point me to ways that some of the
previous steps could be done by a C/C++ program.

I apologize if this is not the right forum for this question.

Thank you,
Joe

Reply With Quote
  #2  
Old   
Peter H. Coffin
 
Posts: n/a

Default Re: Excel to MySQL table - 07-07-2011 , 03:12 PM






On Thu, 07 Jul 2011 14:42:25 -0500, Joseph Hesse wrote:
Quote:
I currently convert an excel file to a mysql table in the following way.

Open excel and delete not needed columns.
Select date columns and format them to YYYY-MM-DD.
Export to a csv file.
Edit the csv file to remove the first line.
Load the csv file to a mysql table.

I would appreciate it if someone can point me to ways that some of the
previous steps could be done by a C/C++ program.
The fourth step there could probably be effectively managed with a C/C++
program. The others are already pretty well-optimized within the range
of what's determinable at compile-time or without much human input.

--
71. If I decide to test a lieutenant's loyalty and see if he/she should
be made a trusted lieutenant, I will have a crack squad of marksmen
standing by in case the answer is no.
--Peter Anspach's list of things to do as an Evil Overlord

Reply With Quote
  #3  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: Excel to MySQL table - 07-07-2011 , 05:08 PM



On 2011-07-07 21:42, Joseph Hesse wrote:
Quote:
I currently convert an excel file to a mysql table in the following way.

Open excel and delete not needed columns.
Select date columns and format them to YYYY-MM-DD.
Export to a csv file.
Edit the csv file to remove the first line.
Load the csv file to a mysql table.

I would appreciate it if someone can point me to ways that some of the
previous steps could be done by a C/C++ program.

In Java and Python there are libraries that can be used to manipulate
excel files. There probably exists something similar for c++ as well
(havent tried one though). I googled for excel c++ and found for example:

http://xlw.sourceforge.net/

If you find a library that works you probably can automate all steps in
the process.


/Lennart

Reply With Quote
  #4  
Old   
onedbguru
 
Posts: n/a

Default Re: Excel to MySQL table - 07-07-2011 , 06:48 PM



On Jul 7, 6:08*pm, Lennart Jonsson <erik.lennart.jons... (AT) gmail (DOT) com>
wrote:
Quote:
On 2011-07-07 21:42, Joseph Hesse wrote:

I currently convert an excel file to a mysql table in the following way..

Open excel and delete not needed columns.
Select date columns and format them to YYYY-MM-DD.
Export to a csv file.
Edit the csv file to remove the first line.
Load the csv file to a mysql table.

I would appreciate it if someone can point me to ways that some of the
previous steps could be done by a C/C++ program.

In Java and Python there are libraries that can be used to manipulate
excel files. There probably exists something similar for c++ as well
(havent tried one though). I googled for excel c++ and found for example:

http://xlw.sourceforge.net/

If you find a library that works you probably can automate all steps in
the process.

/Lennart


load file ignore 1 lines into a tmp table, (see docs for the
"ignore" syntax.
insert into realtable select a,b,d,e from tmptable;
drop tmptable.

Don't make it more difficult than needed.

Reply With Quote
  #5  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: Excel to MySQL table - 07-08-2011 , 12:54 AM



On 2011-07-08 01:48, onedbguru wrote:
Quote:
On Jul 7, 6:08 pm, Lennart Jonsson <erik.lennart.jons... (AT) gmail (DOT) com
wrote:
On 2011-07-07 21:42, Joseph Hesse wrote:

I currently convert an excel file to a mysql table in the following way.

Open excel and delete not needed columns.
Select date columns and format them to YYYY-MM-DD.
Export to a csv file.
Edit the csv file to remove the first line.
Load the csv file to a mysql table.

I would appreciate it if someone can point me to ways that some of the
previous steps could be done by a C/C++ program.

In Java and Python there are libraries that can be used to manipulate
excel files. There probably exists something similar for c++ as well
(havent tried one though). I googled for excel c++ and found for example:

http://xlw.sourceforge.net/

If you find a library that works you probably can automate all steps in
the process.

/Lennart



load file ignore 1 lines into a tmp table, (see docs for the
"ignore" syntax.
insert into realtable select a,b,d,e from tmptable;
drop tmptable.

Don't make it more difficult than needed.
and the conversion from BIFFx (or whatever it is called these days) to csv?


/Lennart

Reply With Quote
  #6  
Old   
Andre
 
Posts: n/a

Default Re: Excel to MySQL table - 07-08-2011 , 07:33 AM



Le Thu, 07 Jul 2011 14:42:25 -0500, Joseph Hesse a écritÂ*:

Quote:
I currently convert an excel file to a mysql table in the following way.

Open excel and delete not needed columns. Select date columns and format
them to YYYY-MM-DD. Export to a csv file.
Edit the csv file to remove the first line. Load the csv file to a mysql
table.

I would appreciate it if someone can point me to ways that some of the
previous steps could be done by a C/C++ program.

I apologize if this is not the right forum for this question.

Thank you,
Joe
Yould try an ODBC link between Mysql and your excel sheet
André

Reply With Quote
  #7  
Old   
The Natural Philosopher
 
Posts: n/a

Default Re: Excel to MySQL table - 07-08-2011 , 07:50 AM



Joseph Hesse wrote:
Quote:
I currently convert an excel file to a mysql table in the following way.

Open excel and delete not needed columns.
Select date columns and format them to YYYY-MM-DD.
Export to a csv file.
Edit the csv file to remove the first line.
Load the csv file to a mysql table.

I would appreciate it if someone can point me to ways that some of the
previous steps could be done by a C/C++ program.

The last to are amenable to automation with a program.

And the second,

But not the first and third

Quote:
I apologize if this is not the right forum for this question.

Thank you,
Joe

Reply With Quote
  #8  
Old   
onedbguru
 
Posts: n/a

Default Re: Excel to MySQL table - 07-08-2011 , 04:18 PM



On Jul 8, 8:50*am, The Natural Philosopher <t... (AT) invalid (DOT) invalid>
wrote:
Quote:
Joseph Hesse wrote:
I currently convert an excel file to a mysql table in the following way..

Open excel and delete not needed columns.
Select date columns and format them to YYYY-MM-DD.
Export to a csv file.
Edit the csv file to remove the first line.
Load the csv file to a mysql table.

I would appreciate it if someone can point me to ways that some of the
previous steps could be done by a C/C++ program.

The last to are amenable to automation with a program.

And the second,

But not the first and third







I apologize if this is not the right forum for this question.

Thank you,
Joe
It is ALL doable, if you have the right tools... found this:
http://capmarketer.com/converting-xl...ls2csv-ubuntu/

While it says ubuntu, it should work with any Linux distro.


the do something like:
perl xlstocsv ifile ofile
mysql
load file ignore 1 lines into a tmp table, (see docs for the
"ignore" syntax.
let the mysql handle the date coversion
insert into real-table select a,b,d,e from tmptable; (notice I
skipped one column)
drop tmptable.

Again, don't make it more difficult than needed.

Reply With Quote
  #9  
Old   
Peter H. Coffin
 
Posts: n/a

Default Re: Excel to MySQL table - 07-09-2011 , 01:53 PM



On Fri, 8 Jul 2011 14:18:45 -0700 (PDT), onedbguru wrote:
Quote:
On Jul 8, 8:50?am, The Natural Philosopher <t... (AT) invalid (DOT) invalid
wrote:
Joseph Hesse wrote:
I currently convert an excel file to a mysql table in the following way.

Open excel and delete not needed columns.
Select date columns and format them to YYYY-MM-DD.
Export to a csv file.
Edit the csv file to remove the first line.
Load the csv file to a mysql table.

I would appreciate it if someone can point me to ways that some of
the previous steps could be done by a C/C++ program.

The last to are amenable to automation with a program.

And the second,

But not the first and third

I apologize if this is not the right forum for this question.

Thank you, Joe

It is ALL doable, if you have the right tools... found this:
http://capmarketer.com/converting-xl...ls2csv-ubuntu/

While it says ubuntu, it should work with any Linux distro.


the do something like: perl xlstocsv ifile ofile mysql load file
ignore 1 lines into a tmp table, (see docs for the "ignore" syntax.
let the mysql handle the date coversion insert into real-table select
a,b,d,e from tmptable; (notice I skipped one column) drop tmptable.

Again, don't make it more difficult than needed.
You are ignoring the "using C/C++" part, aren't you?

--
26. No matter how attractive certain members of the rebellion are,
there is probably someone just as attractive who is not desperate to
kill me. Therefore, I will think twice before ordering a prisoner
sent to my bedchamber. --Peter Anspach's Evil Overlord list

Reply With Quote
  #10  
Old   
onedbguru
 
Posts: n/a

Default Re: Excel to MySQL table - 07-09-2011 , 02:14 PM



On Jul 9, 2:53*pm, "Peter H. Coffin" <hell... (AT) ninehells (DOT) com> wrote:
Quote:
On Fri, 8 Jul 2011 14:18:45 -0700 (PDT), onedbguru wrote:
On Jul 8, 8:50?am, The Natural Philosopher <t... (AT) invalid (DOT) invalid
wrote:
Joseph Hesse wrote:
I currently convert an excel file to a mysql table in the following way.

Open excel and delete not needed columns.
Select date columns and format them to YYYY-MM-DD.
Export to a csv file.
Edit the csv file to remove the first line.
Load the csv file to a mysql table.

I would appreciate it if someone can point me to ways that some of
the previous steps could be done by a C/C++ program.

The last to are amenable to automation with a program.

And the second,

But not the first and third

I apologize if this is not the right forum for this question.

Thank you, Joe

It is ALL doable, if you have the right tools... found this:
http://capmarketer.com/converting-xl...ls2csv-ubuntu/

While it says ubuntu, it should work with any Linux distro.

the do something like: perl xlstocsv ifile ofile mysql load file
ignore 1 lines into a tmp table, (see docs for the "ignore" syntax.
let the mysql handle the date coversion insert into real-table select
a,b,d,e from tmptable; (notice I skipped one column) drop tmptable.

Again, don't make it more difficult than needed.

You are ignoring the "using C/C++" part, aren't you?

--
26. No matter how attractive certain members of the rebellion are,
* *there is probably someone just as attractive who is not desperate to
* *kill me. Therefore, I will think twice before ordering a prisoner
* *sent to my bedchamber. --Peter Anspach's Evil Overlord list

Since it doesn't require c/c++ - yes. Again, don't make it more
difficult than needed - and programming the thing in c/c++ would be
overkill.

Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.