I am using OLEDB connection to import Data from Excel and fill it in Datatable. 2 columns with numeric value is converted to scientific notation (from 0.00000003 to 3.00E-08). Is there any way or solution to fill as it is (i.e. as numeric value) in datatable.
I have tried adding IMEX=1 in connection string but still didnt work.
Related
I am working on Protege 5.0 with the plugin Celfie. I have imported an excel sheet which has a column Start_Time (datatype dateTime). When i import the excel sheet into protege, it converts the rows from dateTime format to a string or some other data type. I want to use that column for a data property having the data type DateTime.
I have attached screenshots of both my excel sheet and the celfie tab. Any help would be appreciated.
Celfie Plugin Tab snapshot
Excel Sheet snapshot
The issue is actually a formatting issue in Protege. In Excel, date times are stored as floats, with the integer representing the date and the decimals representing the time.
39448 is 01/01/2008 (https://support.office.com/en-us/article/DATEVALUE-function-df8b07d4-7761-4a93-bc33-b7471bbff252); since the results you're getting in Protege are similar, those seem to be the raw date time values.
You need to convert them in Protege, either by using an informat when you pull them from Excel, or by formatting them in Protege in the same manner that Excel would.
What is difference between value with warning "The number in this cell is formatted as text or preceded by an apostrophe" and value without this warning? Excel source data
Problem is when the data are imported in SSIS and rows until 2207 are imported correct but from 2208 are just NULL
Simple example SSIS diagram and the data from viewer while debuging
I use such ConnectionString:
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Filename.xlsm;Extended
Properties="EXCEL 12.0 MACRO;HDR=NO;IMEX=2";
It doesn't matter if I use
"IMEX=1" or "IMEX=2"
Columns A..P are (DT_WSTR,255) type.
How to ensure that imported values were the same like in source Excel file (if possible without changing Excel source file)?
Try adding a derived column node and convert the columns to text (versus the wstr). Make sure you map the derived column in your output. If text doesn't work try int or numeric.
I need to read a Microsoft Excel 2003 file (.xls) from a query in SQL Server 2005, and then insert some of that data into some tables. Reading the file and then using its data is not a problem in itself, but I found that, for a column, sometimes I get a NULL value instead of the value that's shown in the Excel file. To be more specific: This column is always just one character long, and it can contain any one digit from 0-9, or the letter 'K'. It's when the column contains 'K' that the query gives me a NULL value. My assumption is that, since the first few rows contain numbers as the values of this column, the query assumes they will always be numbers, and when it finds a letter it just turns it into NULL.
I tried changing the format of the cells in the Excel file to text, and using CAST and CONVERT (not at the same time) on the value to try to make it a varchar, but it does nothing.
That looks like an older OLE DB driver for Excel. Not that it doesn't work--you can still "query" the spreadsheet with it. Maybe try something newer:
SELECT * FROM
OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0 Xml;HDR=YES;Database=C:\File.xls',
'SELECT * FROM [Sheet1$]')
You'll need an updated ODBC driver on the SQL Server (make sure to get the appropriate 32 vs 64 bit version).
I'm having a big problem getting data from Excel files via connection String.
I connect to xls file and execute this query:
SELECT CDbl(COLUMN_NAME) FROM [SHEETNAME$]
when COLUMN_NAME references a string column (or numeric column with empty cells), it fails. There is any solution? like "ISNULL(COLUMN_NAME, 0)" or someting like that???
Thanks!
Add the property IMEX=1 at the end of your connection string of the Excel connection manager.
Samples:
http://www.connectionstrings.com/excel
This will treat mixed data types as string. However, Excel will only scan the first 8 rows to determine if there are intermixed data types. In order to change that, you need to modify the TypeGuessRows registry setting for the JET provider. If you set it to 0, it will scan all rows.
Here are more references:
http://www.sql-server-helper.com/tips/read-import-excel-file-p02.aspx
http://munishbansal.wordpress.com/2009/12/15/importing-data-from-excel-having-mixed-data-types-in-a-column-ssis/
The mysql table has a DATETIME field. I want to INSERT a new row into this field using the cell data from the Excel worksheet. But I cannot use the datetime formatted cell value in a INSERT INTO query. How can I implement this?
Clarifying how you are using VBA would be helpful, but assuming that you are using VBA primarily to bring the data up to MySQL, you can handle a lot of your formatting right in your Excel workbook. For DATE type data,
=TEXT([the data],"YYYYMMDD")
is effective.
For DATETIME type data,
=TEXT([the data],"YYYYMMDDHHMMSS")
gets interpreted correctly at import by MySQL.
Hope that helps!
You could create a custom format that represents the datetime in the correct way.