Saturday, March 22, 2014

MySQL for Excel Append Error (and a solution)

I use the MySQL for Excel add-in in order to move data between my MySQL database and an Excel workbook I depend on.  Recently, I encountered this error when I tried to append data to a table I had successfully used.  This is my experience and the solution I found.



The source data had nearly 2,000 rows and over 50 columns being appended.  Initially, I created the table using the MySQL for Excel Add-in, then tested it by performing a second append.  I moved to a different set of data and found that about half the columns did not exist in the second data set.  Since much of it was duplication or data validation, I decided to shorten the table by removing the unused columns.

Once the columns were removed, the error above appeared.  I dropped and recreated the table, stopped and started Excel, logged out of the connection and back in, but nothing corrected the problem.  I found the same problem asked on Stackoverflow, but there was no answer.  I couldn't find a reference to the problem anywhere else.

The next day, it occurred to me that the mapping stored within the add-in may be failing because it couldn't find the columns I had removed from the table and didn't know how to adapt.  Sure enough, I restored the dropped columns and the append worked exactly as expected.


No comments:

Post a Comment