Gossamer Forum
Home : General : Databases and SQL :

Seeking Excel to Mysql Dump file tool

Quote Reply
Seeking Excel to Mysql Dump file tool
Hi All

I'm looking for a tool that will take a flatfile, delimited db and convert it into the kind of file that has the mysql arguments in it, like a dump file, only to be used for uploads:

Quote:
# MySQL dump
# Generated by MySQLMan 1.09 (http://gossamer-threads.com/scripts/)
# Host: localhost Database: fred_help
#--------------------------------------------------------

#
# Table structure for table 'users'
#
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id smallint(5) unsigned DEFAULT '' NOT NULL auto_increment,
username varchar(30) ,
password varchar(30) ,
name varchar(50) ,
email varchar(50) ,
url varchar(50) ,
company varchar(50) ,
rkey varchar(5) ,
pending char(1) DEFAULT '' NOT NULL ,
active varchar(50) ,
acode varchar(50) ,
lcall varchar(255) DEFAULT '' NOT NULL ,
PRIMARY KEY (id)
);

#
# Dumping data for table 'users'
#

INSERT INTO users (id,username,password,name,email,url,company,rkey,pending,active,acode,lcall) VALUES('1','user','fredpass','User','user@fred.com','none','Company','FR','0','1016643228','0','1016631653');
INSERT INTO users (id,username,password,name,email,url,company,rkey,pending,active,acode,lcall) VALUES('2','user2','wilmapass','User2','user@wilma.com','none','Company','WI','0','0','0','0');

# ----------- Dump ends -----------

The reason I need this is that some hosts don't allow uploads of flatfile, delimited databases, but they do allow uploads of dump files.

So, I could still import a large db if I could put it in the above format efficiently, even if my host denies uploading flatfiles.

Many thanks for any help. Smile

------------------------------------------
Quote Reply
Re: [DogTags] Seeking Excel to Mysql Dump file tool In reply to
I think the easiest thing would be to import the data into MySQL locally, then have MySQLman produce a dump, which you can transfer to the webhost and insert there...

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Seeking Excel to Mysql Dump file tool In reply to
Interesting idea. The prob is that I don't have mysql on my winXP machine. I'm kind of stuck using the host linux box. If I did, your idea would solve this. Thanks, yogi. Smile

------------------------------------------
Quote Reply
Re: [DogTags] Seeking Excel to Mysql Dump file tool In reply to
Install linux locally Cool

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [DogTags] Seeking Excel to Mysql Dump file tool In reply to
What format is the flat file in? It shouldn't be too hard to do...

Just;

Open file
Read each line
For each line, 'split' it into an array
Then print a new line to the screen, with the correct INSERT syntax, and entries.
Then paste the returned code into your MySQL dump file, and upload to your server ready for importing Smile

Easy enough ;)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [yogi] Seeking Excel to Mysql Dump file tool In reply to
Yeah, I know. I'm still getting used to this xp machine. It's nice to have one that's not crashing all the time Smile

------------------------------------------
Quote Reply
Re: [DogTags] Seeking Excel to Mysql Dump file tool In reply to
It would be nice if MySQL had robust Data Transmission Services (DTS) like SQL Server where you can import data from many different types of files, like Text, Excel, Access, etc., and systems, like Oracle, Lotus Notes, FoxPro, etc.

At work, we use SQL Server and Oracle, and it's really nice to be able to seamlessly IMPORT data from different files without having to edit DUMP files or go through extra steps of first exporting data and then IMPORT those files into MySQL.

Hopefully, the MySQL developers will come up with robust methods of IMPORTing data in the future. I mean they are already developing stored procedures and triggers for the latest version of MySQL, why not robust DTS?
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [DogTags] Seeking Excel to Mysql Dump file tool In reply to
Use Win32::OLE;



It's the absolute dogs.
Quote Reply
Re: [yogi] Seeking Excel to Mysql Dump file tool In reply to
You've got me thinking. The script that I have in mind should be a 2-way thing....Dump2Flat and Flat2Dump

With the Dump2Flat, you could take your dumped files and then use them your spreadsheet program.

With the Flat2Dump, you could take the edited flat delimited files and then create the dump file for upload.

I appreciate everyone's suggestions and help. Smile Smile Smile

------------------------------------------
Quote Reply
Re: [DogTags] Seeking Excel to Mysql Dump file tool In reply to
You're welcome, DogTags.

Although I don't know why you wouldn't just use the IMPORT/EXPORT functions in MySQLMan or even PHPAdmin.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] Seeking Excel to Mysql Dump file tool In reply to
Thanks, everyone. The prob for me is that there is some permissions issue with exporting a delimited file to either the screen or to a file. I wasn't aware that mysql had such a limiting factor, but it can be turned on by admin. However, you can still dump the entire sql file in the format above. That's why I wanted to find a way to convert from simple delimited flatfile to what I'm calling the dumpfile format (with all the commands in it). In fact, this just adds one more question that I now have to ask hosts..."do you allow global permissons on your mysql db's??"

Thanks, again, everyone. Smile

------------------------------------------
Quote Reply
Re: [DogTags] Seeking Excel to Mysql Dump file tool In reply to
I don't know what you mean by "global permissions", but your host should at least give you most of the perms (except for adding new databases) to your MySQL set-up.

I had a problem with my hosting company giving "global permissions" to all users on the MySQL server, which meant that other users could view and dump data from my MySQL databases. In fact, one user actually dumped my whole LINKS SQL database and attempted to use it for his or her own purposes. But my hosting company quickly modified permissions and fixed the problem.
========================================
Buh Bye!

Cheers,
Me