Over the last week, I’ve tried macros, VB, watched Automator tutorials (only to learn that my system didn’t have the necessary Excel modules because I’m using v.X), researched Spreadsheet::WriteExcel and Spreadsheet::ParseExcel (Perl modules, since I’ve learned Perl over the last year)… Before I try another mechanism, I thought I’d throw myself on the mercy of a forum of experienced individuals to find out if what I need to do is possible before failing miserably because I strayed outside the realm of possibility.
Scenario: I have thousands of text files of data: ruthless, ruthless data. I have an Excel template that can process said data painlessly and (relatively) quickly. The problem is that I can’t get from one to the other because (A) methods that can save an Excel spreadsheet based on the original file name (it’s also part of the text file) can’t seem to handle the originating text and (B) methods that can handle the originating text can’t seem to make proper spreadsheet files. I wrote the Perl scripts that generated the output, so they’re about as user-friendly as possible: tab delimited, identically formatted, with all the settings the spreadsheet needs perfectly placed.
What I require, if someone could point me in the right direction is something that would let me:
-Open a text file (for example, “data00001.txt”)
-Paste values into Excel (sheet “Input”, cell “A11” or whatever, I made my template, I can handle adjusting it as long as the data gets in there somewhere)
-Save the file as data00001.xls or data00001.xls.txt… Or “nonesensestringofletters1”, as long as their each unique so I’m not overwriting my data.
Actually, I’ve already written (in one of my failed attempts) a macro for the last two parts if there is some way of saying
-Open text file (in text edit, preferably since it’s quicker)
-Copy all
-Open Excel template
-Run macro1 (that’d paste the data, calculate and then save the file based on the contents of a cell, quick as a bunny)
-Close Excel template (so I don’t have 4,000 Excel files open on my system)
I’ve done some searches and found bits and pieces, but is this combined effort possible in AppleScript? Can it be automated for all the “.txt” files in a folder?
If someone could aim a poor, tired, going-prematurely-gray graduate student in the general direction, I’d be very appreciative.
Thanks for any help or suggestions (or even, “you can’t do that”, which would save me time in trying another doomed-to-fail direction)!
Model: iMac, but have a Pro desktop for the heavy lifting
AppleScript: 2.0.1
Browser: Firefox 3.0.6
Operating System: Mac OS X (10.5)