473,385 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

uploading excel file to mysql

6
plz anybody help me in uploading data from excel file to mysql database. data in excel sheet is in vertical format not horizontally. I mean to say that the columns of mysql tables are in rows in excel.
Feb 14 '07 #1
6 7532
ronverdonk
4,258 Expert 4TB
What usually works for me is statement
Expand|Select|Wrap|Line Numbers
  1. LOAD DATA INFILE 'test.txt' INTO TABLE aa FIELDS TERMINATED BY '\n';
Hereby it treats each line as a value and fills all columns in a row until all are filled, then it starts a new row.

This is based on the MySQL manual at LOAD FILE

Ronald :cool:
Feb 14 '07 #2
Hi.
I would personally prefer the following solution:


* Convert your rows to columns and vice-versa in the excel file. This may be done by selecting and copying all your data; click on Edit->Paste Special. Tick 'Transpose'. Paste the data in a new sheet so that you don't lose your data.

* Save the excel file as a 'Comma-separated values' text file (with extension .txt).

* load the file in mySQL using

Expand|Select|Wrap|Line Numbers
  1. LOAD DATA INFILE 'test.txt' INTO TABLE aa FIELDS TERMINATED BY ',' lines terminated by '\n'
  2.  


Prakash
Feb 15 '07 #3
ronverdonk
4,258 Expert 4TB
vpmurdan: is there any reason why you would take such a (manually performed) detour to get the same results?

Ronald :cool:
Feb 15 '07 #4
chiya
6
Hi.
I would personally prefer the following solution:


* Convert your rows to columns and vice-versa in the excel file. This may be done by selecting and copying all your data; click on Edit->Paste Special. Tick 'Transpose'. Paste the data in a new sheet so that you don't lose your data.

* Save the excel file as a 'Comma-separated values' text file (with extension .txt).

* load the file in mySQL using

Expand|Select|Wrap|Line Numbers
  1. LOAD DATA INFILE 'test.txt' INTO TABLE aa FIELDS TERMINATED BY ',' lines terminated by '\n'
  2.  


Prakash
hi

thanks. I do it, it is good for local server, as I save my csv files in the directory of mysql server where my database was created. But I have to do it for remote mysql server that is installed on remote linux machine. My database is already created there. How can I remotely save my csv files there.
error is:

'/var/lib/mysql/stdDB/test.csv' not found
Feb 17 '07 #5
chiya
6
hi
thankz to all I do it successfully
Feb 17 '07 #6
vpmurdan: is there any reason why you would take such a (manually performed) detour to get the same results?

Ronald :cool:
The detour is b'coz, I could never import excel files directly to mysql. It is also said in the MySQL manual that import feature imports text files.
Hence the detour.
Feb 20 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: no one | last post by:
I need to find a way to upload an Excel file into an MS SQL database using a web control front end. I have my ASP.Net control (using C#) uploading a file to a directory, but the server people now...
10
by: John Smith | last post by:
I know that uploading an image to a database has been covered, oh, about 3 trillion times. However, I haven't found anything covering uploading to a MySQL database with .net. Please don't...
3
by: RJN | last post by:
Hi I've a template excel file which has all the calculations defined. There are certain input values to be entered which gives a lot of output to the user. I don't want to expose the excel sheet...
4
by: newsprofile | last post by:
Can anyone point me in the right direction on how to deal with an xls flie. Sorry to be basic in my request, but the only other file I have to work with is pdf. I'm not sure, is xls the...
0
by: 8hours | last post by:
Hi, My 1st post .. I'm writing an import routine to open a dynamically uploaded excel file, import the data into an MS SQL database, save an image which is always in the same location - named...
2
by: matech | last post by:
I have a problem with uploading special characters from excel files to mysql 5. It doesn't matter if I use UTF-8 or iso-8859-1 when uploading the trademark ™ symbol. htmlspecialchars() or...
5
by: priyammaheshwari | last post by:
Hi all, I have a MS Access database in which requests made by people is stored,but a coulmn for cost is left empty which is suppose to be populated by the administrator.Now the administrator wants...
1
by: codexxx | last post by:
Hi All, We have setup an Amazon webstore and we anticipate uploading 10,000+ products, and therefore to avoid unnecessary manual labor we wish to automate as much of the process of adding and...
4
by: Francesca | last post by:
Hi everybody, I am a real newbie in both perl and relational databases like mysql, and I have been banging my head on the wall trying to understand how to populate a mysql database using an Excel...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.