SSIS: Importing Excel spreadsheet with more than 255 columns

  • Hi,

    I'm trying to import an Excel spreadsheet into SQL Server 2008 that has more than 255 columns.

    The excel spreadsheet is in Office 2007 format and contains macro's causing it to be a .xlsm file.

    As SSIS cannot import directly from a .xlsm file I've installed the Access Data Engine drivers (ACE) to connect to the database.

    This seems to connect correctly but seems to only copy the first 255 columns from the spreadsheet and it contains lots more columns.

    I've tried saving the database as an .xlsx file and used the Excel driver (not ACE) and this also seemed to limit it to 255 characters.

    In desperation I've tried linking an Access database but this also hit the 255 column limit.

    Can anyone offer me a suggestion as to how I can move forward?

    Many thanks.

    Graham

  • I have exactly the same issue. Did you get any responses? Or, did you figure it out on your own, and are you willing to share?

    Thanks,

  • Adam,

    The 255 column limitation is due to MS Access. You should be able to directly connect SSIS to Excel and pull in all the Excel columns in a direct feed.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Craig,

    I'm just using Microsoft SQL Server Management Studio to import from an .xlsx file direction. If I have the import wizard create the table, it only creates the first 255 columns, and imports them. If I first create a table in SQL Server, with the 700 columns that I need, and then try to import, it again only imports the first 255 columns, and leaves the others as NULL.

  • Sorry, "direction" should be "directly".

  • Adam Blumenfeld (1/31/2011)


    Craig,

    I'm just using Microsoft SQL Server Management Studio to import from an .xlsx file direction. If I have the import wizard create the table, it only creates the first 255 columns, and imports them. If I first create a table in SQL Server, with the 700 columns that I need, and then try to import, it again only imports the first 255 columns, and leaves the others as NULL.

    I'll have to muck with it to confirm, but my quick research when I saw this pop up indicated otherwise. However, I can't speak to what the wizard will do. Have you tried creating your own package in BIDS/VS2k8 and creating a source that hooks to Excel 12.0, and then the import?

    I'm currently dealing with the drivers for that now at this location for the newer versions (I use 2k5 and office 2k7 isn't immediately available, without this installed: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en), so once I get that cleaned up in a few days I can perform some local testing.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Hi,

    Sadly I didn't find a way around the problem.

    I was able to create a macro to reformat the spreadsheet so that all of the data I needed was within the first 255 columns and was able to import the data that way.

    The extra problems I had was that the spreadsheet had macro's already in it, so the default driver wouldn't work and I had to use the ACE drivers (and even the beta drivers at the time wouldn't work!).

    Graham

  • Grahamn

    "and contains macro's causing it to be a .xlsm file."

    As you already use a macro why not save the file as a TAB separeted text file etc.txt

    and use SSIS or T-SQL bulk insert to import the file.:-)

    I never use SSIS to import natural Excel files.

    Gosta M

  • Hi,

    I was able to amend the format of the spreadsheet before I imported it.

    As we have a automated process of importing the file, I'd be interested to see if you could execute a macro via SSIS to export it first. 🙂

    Thanks,

    Graham

  • you could use two data sources to load the data then join them together as explained in this Post[/url]

  • Does this have to be uploaded as an Excel file?, why not try .csv or .txt and then it should pull through?

  • it's a file that will be supplied multiple times a day so it's not feasible to convert it every time.

  • "it's a file that will be supplied multiple times a day so it's not feasible to convert it every time."

    Why?

    You have to give us more background information.

    "and contains macro's causing it to be a .xlsm file."

    Why not cange that macro so the file format is .txt

    This Little macro opens a .xlsm file and saves it as a .txt file

    ------

    Workbooks.Open Filename:="XXXXX\YYYY.xlsm"

    ActiveWorkbook.SaveAs Filename:="XXXXX\YYYY.txt", FileFormat:= _

    xlText, CreateBackup:=False

    ------

    Gosta M

Viewing 13 posts - 1 through 12 (of 12 total)

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