Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing Excel sheet into phpMyAdmin

I'm currently playing around with phpMyAdmin and I have encountered a problem. When importing my CSV into phpMyAdmin it's rounding the numbers. I have set the column to be a float and the column in Excel to be a Number (Also tried text/General) to no avail. Has anyone else encountered this issue and found a viable work-around?

A second question, is it possible for me to upload the CSV file so that it matches the column names in phpMyAdmin to Excel column names and enters the data in the correct column?

like image 937
Dannys Avatar asked Dec 25 '22 14:12

Dannys


1 Answers

  1. Your file should be look like this(decimal fields are of general type):

xlssheet

  1. Save as CSV. File will be probably saved with ; separated

This is for new table:

  1. Open phpMyAdmin, choose your database, click to import and select file to upload
  2. Change format to CSV if there is not selected
  3. Change in format specific options - columns separated with: ;
  4. Be sure that checkbox (The first line of the file contains the table column names (if this is unchecked, the first line will become part of the data)) is SELECTED
  5. Click Go
  6. New table will be created with the structure according to the forst line in CSV.

This is for existing table:

  1. Open phpMyAdmin, choose your database, CHOOSE YOUR TABLE which match the structure of imported file, click to import and select file to upload
  2. Change format to CSV if there is not selected
  3. Change in format specific options - columns separated with: ;
  4. Change skip number of queries to 1 (this will skip the first line with column names)
  5. Click Go
  6. Selected table wich has the same structure as CSV will be updated and rows in CSV inserted.
like image 108
Sauron Avatar answered Jan 03 '23 00:01

Sauron