Comments welcome, please, on the relative merits of the ‘do a macro’ and ‘get external data’ routes for inserting into a workbook several columns from another data source (saved as csv), which is updated once or twice a month. The ‘get external data’ route may have the advantage that it offers to copy down formulas in the ‘receiving’ workbook, but there are no doubt other issues, too.
Thanks.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
importing data (97sr2)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » importing data (97sr2)
- This topic has 11 replies, 5 voices, and was last updated 22 years, 7 months ago.
AuthorTopicWSitshimagain
AskWoody LoungerNovember 11, 2002 at 8:43 am #379237Viewing 1 reply threadAuthorReplies-
WSWassim
AskWoody LoungerNovember 11, 2002 at 2:31 pm #630814John
MS-Excel can open CSV files without having to worry about Macros* or Get External Data.
Now you see that * up there, and I have it for this reason.
If the CSV file contains more than 65536 rows in total then a macro is nice to have to “import” the CSV file into multiple worksheets. You can still do this manually but again twice a month is way too many times to do anything manually
.
So let me know if you have more than 65536 rows in the CSV file, and I’ll help you with the VBA code. I have something written already, so you need to only modify it and that is it.
Wassim
-
WSitshimagain
AskWoody LoungerNovember 11, 2002 at 3:10 pm #630827Thanks v much, Wassim.
It might help if I were clearer about the Bigger Picture:
The source csv file is the output from a DOS accounts package, and contains 115 fields and at present about 300 records (this will grow as membership grows, but is unlikely to breach the 65,000-record for ‘some time’.) Total size ~250kB, or 25kB zipped.
The ‘target’ application is an xl workbook which looks at the data in about 20 of these fields (non-contiguous), which are about people, where they live and how old they are, when they joined and aspects of their finances like their savings, their loan and the repayment history of their loan.
From this, do_it_all.xls (modest filename, eh?) does a number of useful things, like adding up total savings and loans, producing an insurance report in which members’ ages are an element, looking for dodgy loan repayment history and generating suitable letters, alerting to rising – x’s where the x’s are watershed ages, and there are more planned, like creating charts. Another useful thing it does is work round the insistence of Bill Gates that anyone with a date of birth like 23-12-18 must have a negative age!
So far it’s about 2 MB so a bit big to transmit by email to other users, even if zipped (c. 0.5MB) And this will get worse.
It’s designed for people like cashiers who aren’t particulalrly computerate.
Therefore there are a number of ‘point and shoot’ macros triggered by big buttons, and hyperlinks.
At present the most ambitious macro is the one which fetches the fields it wants from the source data, reformats that data so that dates look like dates and money looks like money, pastes it into my toy (replacing the existing data), and closes the csv file.
My question is, is this the most sensible way of doing it, or would the ‘get external data’ trick in the Tools menu be more efficient? -
WSStats
AskWoody LoungerNovember 11, 2002 at 5:24 pm #630858Okay…so maybe I’m a little bias, I’ve used MS-Query (“Get External Data”) quite a bit and I have little experience with macros. Using the Query allows you to pull off the data any way you want using as many parameters as you want. I think it would be very useful if you are trying to get different data at different times, for example, you can use query to get all of the people over a certain age, with more than x in savings and a loan balance less than y.
If you need to pull the same data once or twice a month to update your records the Query will work well for that too. Each time you run the query (you can set it up to run every time the workbook is opened or just when you tell it to) it will copy adjacent coloumns containing formulas you require.
I’m sure the folks who are proficient at macros will say the same thing about their tools of choice but I find the Query to be very easy and quick to work with.Stats
-
WSWassim
AskWoody LoungerNovember 11, 2002 at 9:35 pm #630914John
for the detailed description, here is my humble opinion:
As long as you are using CSV files, opening these files directly into MS-Excel is the best, easiest, fastest, least hassle way of working this situation.
GetExternalData is quite elegant when you are working with true databases, but might be an overkill in CSV cases.
Once you get your data into MS-Excel, then your macro will format, delete, and present the data into the format you like best.
As to sharing the data, think of the opposite. Have your application save the formatted data back into a CSV file and ship this CSV file(s) to the ultimate users. The CSV files are manageable from the size issue, and very easy to work with via e-mail.
Yes, this will result in more VBA coding on your part, but you love it don’t you
?
Let me know what you think.
Wassim
-
-
-
WSAndrewO
AskWoody LoungerNovember 11, 2002 at 6:47 pm #630876Normally the standard importers are great – I’d use them in preference to a Macro.
The times I’ve found that I had to write a Macro are when the data is ‘difficult’ and the importers are automating incorrectly for the data.This situation happens in several key areas
1 where numbers need to be treated as text (e.g. partnumbers with leading zeros, or part numbers like 1234E15)
2 where quotes are important (or not)
3 where dd/mm/yy style dates are used (dates up to 12/mm/yy become valid dates, and anything else gets very complicated)
Sometimes a Macro is also required for Output – especially where quotes are important. (Excel insists on only quoting where it feels it has to)
-
WSWassim
AskWoody LoungerNovember 11, 2002 at 9:40 pm #630915Andrew
In reference to <<< 3 where dd/mm/yy style dates are used (dates up to 12/mm/yy become valid dates, and anything else gets very complicated)
>>>Your Regional Settings should take care of that, unless you get data from the US and then other parts of the World. This is why I prefer a standard yyyy/mm/dd and then change it via macros or Regional Settings to what the user will like to see.
Check your settings in the Control Panel and make sure they are set properly.
Wassim
-
WSAndrewO
AskWoody Lounger -
WSAndrewO
AskWoody LoungerNovember 12, 2002 at 1:15 am #630959Wassim
While I may have been working from history – there are definitely issues that still surface from time to time. See the attached quote (posted today) from the Microsoft bulletin board
I tested the Macro – and Greg is correct with his assertion.“This error has been around in various guises since Office
95, and unbelievably persists in Office XP
1. When the Regional Setting is dd/mm/yyyy (or any day-
Month setting), and
2. CSV’s are loaded via VBA, or
3. Date values are transferred to VBA variables
and
4. Transferred back to a worksheet cellthe day and month are transposed.
See the example belowValues entered in cells A1:A7
10-Jan-02
07/11/2002
15/11/2002
10/01/2002
01/11/2002
09-Dec-02
12-Sep-02A macro is run:
Sub testDates()
Dim varRange As Variant
varRange = Range(“A1:A7”)
Range(“B1:B7″) = varRange
End SubThe Results are:
01-Oct-02
11/07/2002
11/15/2002
01/10/2002
11/01/2002
12-Sep-02
09-Dec-02And Day(B3) returns #Value! surprise surprise.
That really is a shocker!Greg Lesnie
Sydney” -
WSpieterse
AskWoody LoungerNovember 12, 2002 at 6:10 am #630991It is -as Microsoft says- “by design”.
VBA speaks US English in all it’s work and uses US locale in all Excel functions called by VBA, including importing. Therefore a recorded macro of an import that worked perfect will yield problematic code, because from the UI the import speaks locale and from VBA the same, recorded, import speaks US english. It is a tremendous problem, but one to live with. There is something to say in favour, but only if one creates utilities for more than just oneself (As I do).
In Excel XP a number of options has been added to overcome these problems. In XP one can tell XL what local settings it is to use.
An excellent chapter on this subject may be found in this book:
Excel 2000/2002 VBA Programmers Reference. Stephen Bullen, John Green, Rob Bovey, Robert Rosenberg. Wrox Press.
That being said, what can be done?
– Use XL XP and use the locale options in your code
– Reformat the dates so whatever locale is set, the dates come out OK because you rework them in a macro (suggested already)
– use sendkeys and application.commandbars.FindControl(Id:=????).Execute to display and OK the file open dialog (this forces Excel to think it was called from the UI and XL will use locale settings):Sub test()
SendKeys “C:DataYourFile.csv~”
Application.CommandBars.FindControl(ID:=23).Execute
End Sub -
WSAndrewO
AskWoody Lounger -
WSitshimagain
AskWoody LoungerNovember 12, 2002 at 2:33 pm #631159Thank you all very much indeed. This thread has been
a) useful, andinteresting, especially because of the hare which I hadn’t intended to start running!
As I’ve got to do a rejig of my application to handle data from a different source shortly, I think I’ll try it both ways, and see which my users prefer.
Strikes me that if MS Query is not installed by default, that’s an issue (but scarcely hard to rectify.)
-
-
-
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Win 11 24H2 June 2025 Update breaks WIFI
by
dportenlanger
39 minutes ago -
Update from WinPro 10 v. 1511 on T460p?
by
CatoRenasci
37 minutes ago -
System Restore and Updates Paused
by
veteran
3 hours, 10 minutes ago -
Windows 10/11 clock app
by
Kathy Stevens
4 hours, 52 minutes ago -
Turn off right-click draw
by
Charles Billow
6 hours, 24 minutes ago -
Introducing ChromeOS M137 to The Stable Channel
by
Alex5723
9 hours, 55 minutes ago -
Brian Wilson (The Beach Boys) R.I.P
by
Alex5723
11 hours, 6 minutes ago -
Master patch listing for June 10, 2025
by
Susan Bradley
11 hours, 31 minutes ago -
Suggestions for New All in One Printer and a Photo Printer Windows 10
by
Win7and10
3 hours, 33 minutes ago -
Purchasing New Printer. Uninstall old Printer Software First?
by
Win7and10
17 hours, 33 minutes ago -
KB5060842 Issue (Minor)
by
AC641
22 hours, 6 minutes ago -
EchoLeak : Zero Click M365 Copilot leak sensitive information
by
Alex5723
1 day ago -
24H2 may not be offered June updates
by
Susan Bradley
7 hours, 3 minutes ago -
Acronis : Tracking Chaos RAT’s evolution (Windows, Linux)
by
Alex5723
1 day, 13 hours ago -
June 2025 updates are out
by
Susan Bradley
1 hour, 30 minutes ago -
Mozilla shutting Deep Fake Detector
by
Alex5723
2 days, 3 hours ago -
Windows-Maintenance-Tool (.bat)
by
Alex5723
1 day, 13 hours ago -
Windows 11 Insider Preview build 26200.5641 released to DEV
by
joep517
2 days, 6 hours ago -
Windows 11 Insider Preview build 26120.4250 (24H2) released to BETA
by
joep517
2 days, 6 hours ago -
Install Office 365 Outlook classic on new Win11 machine
by
WSrcull999
2 days, 6 hours ago -
win 10 to win 11 with cpu/mb replacement
by
aquatarkus
1 day, 22 hours ago -
re-install Windows Security
by
CWBillow
2 days, 9 hours ago -
WWDC 2025 Recap: All of Apple’s NEW Features in 10 Minutes!
by
Alex5723
2 days, 13 hours ago -
macOS Tahoe 26
by
Alex5723
2 days, 7 hours ago -
Migrating from win10 to win11, instructions coming?
by
astro46
18 hours, 50 minutes ago -
Device Eligibility for Apple 2026 Operating Systems due this Fall
by
PKCano
1 day, 22 hours ago -
Recommended watching : Mountainhead movie
by
Alex5723
1 day, 22 hours ago -
End of support for Windows 10
by
Old enough to know better
3 hours ago -
What goes on inside an LLM
by
Michael Covington
1 day, 17 hours ago -
The risk of remote access
by
Susan Bradley
12 hours, 46 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.