question

NavinkumarKanagaraj-1813 avatar image
0 Votes"
NavinkumarKanagaraj-1813 asked ZoeHui-MSFT commented

Import Excel Sheet to a SQL Table

HI,

Here I am trying to import excel data to sql table. But I could see that Based on the no of rows present in the Database table, It is providing as much null values.

If suppose, I am having the table name Car in DB. If I try to import Data to the same Table where I have the Additional Data in the excel file and it Consists of only 5 rows. I Could see that after importing, there are 18 rows total and where 4 rows consisting full of Null values.

How to avoid this when importing itself.

Please Help me out. Thanks.

sql-server-generalsql-server-integration-services
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

OlafHelper-2800 avatar image
1 Vote"
OlafHelper-2800 answered

That's not really a SQL Server problem, that's how Excel works.
Once you touch a cell Excel think you entered it and on import you get that rows as well.

Delete the unwanted rows after import.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ZoeHui-MSFT avatar image
1 Vote"
ZoeHui-MSFT answered ZoeHui-MSFT commented

Hi @NavinkumarKanagaraj-1813,

Are you using SSIS to load the data to the table?

If yes, you may use sql command when using excel source to load data, and the you can remove the null values.

 select Id,name from [sheetname$]
    
 where Id is not null

Or you may use Conditional Split, check here.

Regards,

Zoe


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Do you have further question on this , could we offer more support?
If this helps on your issue, you could mark it as answer so other user with similar problem could see this easier. :)

0 Votes 0 ·