Hi,
I need to import an Excel sheet into a database table.
The table doesn't exist, so it must be created by reading the Excel exactly by the first row.
For each column the database type must be set.
So how can i set "DATE", "TIME" or "INTEGER" datatype in the create SQL Statement?
The TXLSCellType has none of this types. Only string and float.
Thanks
Import Excel in Database New Created Table
-
- Posts: 1
- Joined: Wed Aug 10, 2016 8:53 am
Re: Import Excel in Database New Created Table
Hello
An Excel worksheet has four types of cells, string, float, boolean and error. Integers are written as float. Date and time are also written as float but the cell is formatted to show the value as a date or time value. Example:
An Excel worksheet has four types of cells, string, float, boolean and error. Integers are written as float. Date and time are also written as float but the cell is formatted to show the value as a date or time value. Example:
Code: Select all
// Add two cells with the current date and time.
XLS[0].AsFloat[1,1] := Now;
XLS[0].AsFloat[1,2] := Now;
// Format cell B2 as date.
XLS[0].Cell[1,1].NumberFormat := 'YYYY-MM-DD';
// Format cell B3 as time.
XLS[0].Cell[1,2].NumberFormat := 'HH:MM';
Lars Arvidsson, Axolot Data