Microsoft Knowledge Base Email Alertz

(207878) - When you try to import a Microsoft Excel spreadsheet into a Microsoft Access database, you may receive the following error message: An error occurred trying to import file 'File Name'. The file was not imported.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 207878 - Last Review: July 16, 2004 - Revision: 1.1

ACC2000: Cannot Import Spreadsheet If Field Name Begins with Space

This article was previously published under Q207878
Moderate: Requires basic macro, coding, and interoperability skills.

On This Page

SYMPTOMS

When you try to import a Microsoft Excel spreadsheet into a Microsoft Access database, you may receive the following error message:
An error occurred trying to import file '<File Name>'. The file was not imported.

CAUSE

The error occurs if there is a space preceding one or more of the field names in the spreadsheet.

RESOLUTION

You can resolve the error in the following ways:
  • Open the spreadsheet in Microsoft Excel and remove the leading space from the field name.
  • Link the spreadsheet in Microsoft Access instead of importing it.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Problem

  1. Start Microsoft Excel and create the following spreadsheet. Type a space in front of the word "Cost":
       Item           <space>Cost       Quantity
       a                   25              2
       b                   23              8
    					
  2. Save the file as C:\My Documents\TestSpace.xls, and then quit Microsoft Excel.
  3. Start Microsoft Access and open the sample database Northwind.mdb.
  4. On the File menu, point to Get External Data, and then click Import.
  5. In the Import dialog box, select Microsoft Excel (*.xls) in the Files Of Type box, and then click TestSpace.xls. Click Import.
  6. Click Next in the first dialog box of the Import Spreadsheet Wizard.
  7. In the Does the first row specified contain column headings? dialog box, click First Row Contains Column Headings, and then click Finish. Note that you receive the error message.

    To resolve the error, open TestSpace.xls in Microsoft Excel and remove the space in front of the word "Cost." Then repeat steps 2 through 7 and note that the error does not occur.

REFERENCES

For more information about importing data, click Microsoft Access Help on the Help menu, type import data in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

APPLIES TO
  • Microsoft Access 2000 Standard Edition
Keywords: 
kberrmsg kbbug kbnofix kbinterop KB207878
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Patrick McKelvey - pat.mckelvey NOSPAM-AT-NOSPAM reichhold.com Report As Irrelevant  
Written: 11/10/2004 4:41 PM
I looked at a dozen discussion and newsgroup sites trying to solve this problem. This problem with the MS Access wizard that imports spreadsheets also exists in MS Access 2002. It is not limited to ACC2000.

BENNO Report As Irrelevant  
Written: 5/19/2005 11:27 AM
It is exist in Access 2003 too

Jami Klein Report As Irrelevant  
Written: 8/16/2005 8:29 AM
Dear kbalertz RE: ACC2000: Cannot Import Spreadsheet If Field Name Begins with Space I found this information very useful. After being perplexed by the problem mentioned above, I did a Google search on "problems importing excel spreadsheets into MS Access". The first hit was this page. Thanks for helping. Kind Regards Jami Klein South Africa

Carl Hoeg Report As Irrelevant  
Written: 12/28/2005 1:40 AM
Great article !! helped me (ACC202 SP3) sort my problem :-)

dimsandwich Report As Irrelevant  
Written: 4/3/2007 7:37 AM
Excellent, similar problem when importing to an existing table and the incoming excel sheet has full stop "." in the header cells while the existing table does not. Take out the "."'s and the import works.

Anonymous User Report As Irrelevant  
Written: 7/3/2007 10:09 AM
Also, get the similar error when try to import in the existing table and incoming excel sheet has duplicate header. Make the header (column name) in consistent with existing table.

Anonymous User Report As Irrelevant  
Written: 7/16/2008 10:03 AM
Very nice... Thanks a lot for posting this.. I spent an hr on this before looking it up online...

Anonymous User Report As Irrelevant  
Written: 8/8/2008 9:55 AM
Thank you. This was the exact problem and the exact solution. Didn't know to look for spaces in the names... I do now! ;-)

Conor Report As Irrelevant  
Written: 10/6/2008 8:49 AM
Spot on. One problem, one solution. I actually missed one of the columns that had a leading space and went looking for some other problem, but this is the answer.

Anonymous User Report As Irrelevant  
Written: 4/18/2009 9:01 PM
This error also occurs if you have an apostrophe (')in a field name.