Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Importing from a improperly formatted excel file Expand / Collapse
Author
Message
Posted Wednesday, September 25, 2013 1:39 PM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Yesterday @ 11:01 AM
Points: 656, Visits: 3,960
Any guidance would be appreciated. Despite my protestations I have been tasked to import from an excel file. The file is not what I would call a proper data file. The data will start in cell D10 and end in cell Kx where x is the number of data rows in the file.

What are my options here. My first thought would be to use SSIS and dump say cell A1 through K10000 ( assuming I would never have more than 10000 rows) into a staging table and parse the data out.

Anyone been down this road...?
Post #1498571
Posted Wednesday, September 25, 2013 3:34 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 1:44 PM
Points: 927, Visits: 5,898
One option might be to use Access (shudder, I know) to create a linked table that only links to the data you want and then export that back to Excel to a new file.

Post #1498607
Posted Wednesday, September 25, 2013 3:43 PM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Yesterday @ 11:01 AM
Points: 656, Visits: 3,960
pietlinden (9/25/2013)
One option might be to use Access (shudder, I know) to create a linked table that only links to the data you want and then export that back to Excel to a new file.


So access can create linked table to a portion of a spreadsheet? And then I could create a linked server from SQL Server to the access table? Never would have thought of it. I would be venturing into Rube Goldberg machine territory.

Ok I'll add this to the list of possible solutions.
Post #1498613
Posted Wednesday, September 25, 2013 5:19 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 1:44 PM
Points: 927, Visits: 5,898
See the second example in this article:
http://access.mvps.org/access/general/gen0008.htm

then once the data is in Access, you can do whatever... (Probably export back out... and go through SSIS as planned.)
Post #1498629
Posted Wednesday, September 25, 2013 9:10 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, December 10, 2014 12:17 PM
Points: 1,095, Visits: 3,182
Another option (and another shudder ) if you don't mind waiting and have a sandbox type database it to:
Creating a staging table for the data.
Selecting the 'Edit top 200 rows' option in the SMSS drop down menu.
Copy the data in Excel and paste into the edit grid.

Beware this is slow and I only do it for ad hoc data where I have no more than a couple of thousand or so rows. It does generally get the data in there with minimal fuss.
Post #1498651
Posted Friday, September 27, 2013 4:41 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 6:16 AM
Points: 380, Visits: 464
I've been there and done something similar to what you need to do.
I used Access and created a linked table to the spreadsheet and another linked table to the staging table on SQL.
The data was then dumped into the staging table before being processed and put into the production tables.
Doing it this way, you can add things like "is not null" to ignore the empty rows at the start of the file at either end of import.
It's not the fastest thing in the world but it worked for me.
Post #1499305
Posted Friday, September 27, 2013 4:51 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Monday, December 15, 2014 10:57 PM
Points: 517, Visits: 646
well i guess,,,,,, SSIS package (Data Flow task ) may help you in this.

IF,Number of columns in your excel files are going to be fix.....Then u can pump "N" number of rows into your Database tables.
Post #1499307
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse