0

I'm trying to automate a tedious problem. I get large Excel (.xls or .csv, whatever's more convenient) files with lists of people. I want to compare these against my MySQL database.*

At the moment I'm exporting MySQL tables and reading them from an Excel spreadsheet. At that point it's not difficult to use =LOOKUP() and such commands to do the work I need, and of course the various text processing I need to do is easy enough to do in Excel.

But I can't help but think that this is more work than it needs to be. Is there some way to get at the MySQL data directly from Excel? Alternately, is there a way I could access a reasonably large (~10k records) csv file in a sql script?

This seems to be rather basic, but I haven't managed to make it work so far. I found an ODBC connection for MySQL but that doesn't seem to do what I need.

  • In particular, I'm testing whether the name matches or whether any of four email addresses match. I also return information on what matched for the benefit of the next person to use the data, something like "Name 'Bob Smith' not found, but 'Robert Smith' matches on email address robert.smith@foo".

2 Answers 2

1

You can use ADO and SQL. This example is an insert query, but any query will work:

Excel VBA: writing to mysql database

Sign up to request clarification or add additional context in comments.

1 Comment

With MySQL & a CSV, you could even use VBScript or such like.
0

Why don't you load your CSV data into a dedicated table and perform your searches using MySQLs functions?
You could even do the logic from within excel (VBA or dotNET, depending on release)

No matter what you do, you will have to write a bunch of code, if you wan't to detect Robert Smith...

1 Comment

Both the data in the csv files and the date in MySQL change frequently, so I can't move one into the other and be done with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.