Importing from a improperly formatted excel file

  • 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...?

  • 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.

  • 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.

  • 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.)

  • 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.

  • 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.

  • 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.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply