473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Plan for mass import of Excel files

I have a large number of Excel files that contain Survey questions and
responses (I know the design is awful... I inherited this mess). Basic
structure is like this:

Demographic Questions | Survey Questions

the first row contains field names. So querying is not a huge problem.
I found this (finally!)

SELECT *
FROM [Excel 8.0;HDR=YES;IMEX=1;Database=C:\ClientInfo.xls;].[Sheet1$];

Then I can just loop through the files in a folder and process them all
in sequence.

Now for the fun part. I need to probably alias column names. Is
creating a table of (AccessField, XLColumnName) pairs the way to go?
then I could write the SQL on the fly and then just use
DBEngine(0)(0).Execute or use an ADO command...

Any thoughts?

I'm just thinking that doing a zillion of these manually is going to
get really old...

Thanks!
Pieter

Jan 23 '07 #1
6 2039
On 22 Jan 2007 22:20:06 -0800, pi********@hotmail.com wrote:

Yes, an Alias table (ExcelFieldName, AccessQuestionID) is a good idea.
It can even accommodate the various spellings of a particular
question.
You did notice I did not say AccessFieldName, because I want to
normalize the design. Rather than a table with N AnswerX fields, I
want a table with QuestionID, Answer, and perhaps a few more fields
(a/o RespondentID).

-Tom.

>I have a large number of Excel files that contain Survey questions and
responses (I know the design is awful... I inherited this mess). Basic
structure is like this:

Demographic Questions | Survey Questions

the first row contains field names. So querying is not a huge problem.
I found this (finally!)

SELECT *
FROM [Excel 8.0;HDR=YES;IMEX=1;Database=C:\ClientInfo.xls;].[Sheet1$];

Then I can just loop through the files in a folder and process them all
in sequence.

Now for the fun part. I need to probably alias column names. Is
creating a table of (AccessField, XLColumnName) pairs the way to go?
then I could write the SQL on the fly and then just use
DBEngine(0)(0).Execute or use an ADO command...

Any thoughts?

I'm just thinking that doing a zillion of these manually is going to
get really old...

Thanks!
Pieter
Jan 23 '07 #2


On Jan 23, 7:57 am, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On 22 Jan 2007 22:20:06 -0800, pietlin...@hotmail.com wrote:

Yes, an Alias table (ExcelFieldName, AccessQuestionID) is a good idea.
It can even accommodate the various spellings of a particular
question.
You did notice I did not say AccessFieldName, because I want to
normalize the design. Rather than a table with N AnswerX fields, I
want a table with QuestionID, Answer, and perhaps a few more fields
(a/o RespondentID).

-Tom.
Duly noted. Thanks Tom! Now I just have to wait for the DB to arrive.
The company just purchased the Access version of Research Tracker.
Once the database gets here, I can hopefully figure out the mappings.

I have to sort out weird mappings. Several columns in Excel, with only
one filled in (usually with an X) will have to collapse to one field in
my table. Easy enough to write an IIF clause to fix it, but are there
good ways of identifying fields like that? Use EXISTS and two SQLs?

Yeah... test it out... I'm on it. (Sorry, sort of thinking out loud.)

Pieter

Jan 24 '07 #3
On 23 Jan 2007 16:08:48 -0800, pi********@hotmail.com wrote:

Collapsing several Yes/No fields into a single field, I would resort
to binary: first re-value those columns from Null and 'X' to 0 and 1.
Then add them up:
(say we have 4 fields, YN1 ... YN4)
select YN1*8 + YN2*4+YN3*2+YN4*1 as CombinedValue from SomeTable
This would give you a unique value between 0 and 2^4-1, and you have
lost no information.

-Tom.

>

On Jan 23, 7:57 am, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
>On 22 Jan 2007 22:20:06 -0800, pietlin...@hotmail.com wrote:

Yes, an Alias table (ExcelFieldName, AccessQuestionID) is a good idea.
It can even accommodate the various spellings of a particular
question.
You did notice I did not say AccessFieldName, because I want to
normalize the design. Rather than a table with N AnswerX fields, I
want a table with QuestionID, Answer, and perhaps a few more fields
(a/o RespondentID).

-Tom.

Duly noted. Thanks Tom! Now I just have to wait for the DB to arrive.
The company just purchased the Access version of Research Tracker.
Once the database gets here, I can hopefully figure out the mappings.

I have to sort out weird mappings. Several columns in Excel, with only
one filled in (usually with an X) will have to collapse to one field in
my table. Easy enough to write an IIF clause to fix it, but are there
good ways of identifying fields like that? Use EXISTS and two SQLs?

Yeah... test it out... I'm on it. (Sorry, sort of thinking out loud.)

Pieter
Jan 24 '07 #4


On Jan 23, 9:35 pm, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On 23 Jan 2007 16:08:48 -0800, pietlin...@hotmail.com wrote:

Collapsing several Yes/No fields into a single field, I would resort
to binary: first re-value those columns from Null and 'X' to 0 and 1.
Then add them up:
(say we have 4 fields, YN1 ... YN4)
select YN1*8 + YN2*4+YN3*2+YN4*1 as CombinedValue from SomeTable
This would give you a unique value between 0 and 2^4-1, and you have
lost no information.

-Tom.

The guy is going to re-enter all the data manually. I think he's
completely out of his mind. Sure, they're spreadsheets, but if you
know what you're doing, you can clean the mess up with VB... I guess he
doesn't really want to...
>
On Jan 23, 7:57 am, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On 22 Jan 2007 22:20:06 -0800, pietlin...@hotmail.com wrote:
Yes, an Alias table (ExcelFieldName, AccessQuestionID) is a good idea.
It can even accommodate the various spellings of a particular
question.
You did notice I did not say AccessFieldName, because I want to
normalize the design. Rather than a table with N AnswerX fields, I
want a table with QuestionID, Answer, and perhaps a few more fields
(a/o RespondentID).
-Tom.
Duly noted. Thanks Tom! Now I just have to wait for the DB to arrive.
The company just purchased the Access version of Research Tracker.
Once the database gets here, I can hopefully figure out the mappings.
I have to sort out weird mappings. Several columns in Excel, with only
one filled in (usually with an X) will have to collapse to one field in
my table. Easy enough to write an IIF clause to fix it, but are there
good ways of identifying fields like that? Use EXISTS and two SQLs?
Yeah... test it out... I'm on it. (Sorry, sort of thinking out loud.)
Pieter
Jan 24 '07 #5
On 23 Jan 2007 19:42:03 -0800, pi********@hotmail.com wrote:

Sigh.
In Dutch we say: throwing pearls before the swines :-)

-Tom.

>

On Jan 23, 9:35 pm, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
>On 23 Jan 2007 16:08:48 -0800, pietlin...@hotmail.com wrote:

Collapsing several Yes/No fields into a single field, I would resort
to binary: first re-value those columns from Null and 'X' to 0 and 1.
Then add them up:
(say we have 4 fields, YN1 ... YN4)
select YN1*8 + YN2*4+YN3*2+YN4*1 as CombinedValue from SomeTable
This would give you a unique value between 0 and 2^4-1, and you have
lost no information.

-Tom.

The guy is going to re-enter all the data manually. I think he's
completely out of his mind. Sure, they're spreadsheets, but if you
know what you're doing, you can clean the mess up with VB... I guess he
doesn't really want to...
>>
>On Jan 23, 7:57 am, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On 22 Jan 2007 22:20:06 -0800, pietlin...@hotmail.com wrote:
>Yes, an Alias table (ExcelFieldName, AccessQuestionID) is a good idea.
It can even accommodate the various spellings of a particular
question.
You did notice I did not say AccessFieldName, because I want to
normalize the design. Rather than a table with N AnswerX fields, I
want a table with QuestionID, Answer, and perhaps a few more fields
(a/o RespondentID).
>-Tom.
>Duly noted. Thanks Tom! Now I just have to wait for the DB to arrive.
The company just purchased the Access version of Research Tracker.
Once the database gets here, I can hopefully figure out the mappings.
>I have to sort out weird mappings. Several columns in Excel, with only
one filled in (usually with an X) will have to collapse to one field in
my table. Easy enough to write an IIF clause to fix it, but are there
good ways of identifying fields like that? Use EXISTS and two SQLs?
>Yeah... test it out... I'm on it. (Sorry, sort of thinking out loud.)
>Pieter
Jan 24 '07 #6


On Jan 23, 10:01 pm, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On 23 Jan 2007 19:42:03 -0800, pietlin...@hotmail.com wrote:

Sigh.
In Dutch we say: throwing pearls before the swines :-)

-Tom.
Hey, I offered him what I'd written so far. Why he would choose to
manually reenter all the data is completely beyond me. Yes, the
cleanup would be ugly, but easier than reentering it all... but if he
feels that's a good use of his money, then so be it.

Jan 24 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Johnny Meredith | last post by:
I have seven huge fixed width text file that I need to import to Access. They contain headers, subtotals, etc. that are not needed. There is also some corrupt data that we know about and can...
3
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook -...
0
by: autoEx | last post by:
I am using #import directive to import the excel library to make excel files but the excel object is not recognized by my application. Here is what I do: I have simple dialog based MFC application in...
5
by: Hunter Hillegas | last post by:
I have a CSV file with 400,000 lines of email mailing list information that I need to migrate to a new PostgreSQL database. Each line has all the info I need except a PK (I usually use an int4...
2
by: amy | last post by:
Hi, all: i am a new end user of access, now I have many excel files need to import to One table in access (combine all excel files into one table in excel). In excel files, some columns will have...
3
by: ninrulz | last post by:
I will try to explain my situation. I know that it is hard to offers solutions without fully understanding what people would like to achieve. I receive 2 csv files every month. The csv files...
11
by: MD | last post by:
Hello, I need to import a sheet of 884 different excel-file with same lay- out. The sheet name is 'Totaal' and is the same in all different files. Is there a script (module) in order to: 1....
8
by: shenkel55 | last post by:
I'm using Access and Excel 2003. Using either the import wizard or code, I have the same problem. This problem only happens with Excel files automatically generated by Corp IT. If I try to do an...
6
by: provor | last post by:
Hello, I have the following code that I am using when a user presses a button to import an excel file into a table. The code is hard coded to point to the correct table. This works great for this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.