Re: From tab text to Excel
Re: From tab text to Excel
- Subject: Re: From tab text to Excel
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 11 Apr 2005 18:54:22 -0700
Title: Re: From tab text to Excel
On 4/11/05 4:51 PM, "Eric Geoffroy" <email@hidden> wrote:
I'm going to add a repeat to this once it's working.
I have a tab delim text file, but putting the items into a worksheet I'm stymied. Some of the text in the file is separated by a space, but I'm only concerned with the tab. I mucked around with text item delimter.
set emmlyst to read EMMlog using delimiter {ASCII character 10} --(So far so good. the first line works. yay!)
tell application "Microsoft Excel"
set Value of Range "B1:B3" of Sheet 1 of Workbook "Workbook1" to paragraph 1 of item 1 of emmlyst
end tell
Well that didn't work. I realize I made a huge assumption that the tabs would be read into Excel. I'm not really an optimist usually.
Do I need to be granular about this and fill each cell with each word.
But by using delimiter {ASCII character 10} you've already made a list of paragraphs. (If your text file was an LF line-ending text.) Also I'm not quite sure why you've put list brackets around ASCII character 10. That would be for 'using delimiters' (plural). If you're 'using delimiter' (singular) the argument is a string. Maybe it coerces to a string. Anyway, why not
set r to read EMMlog
set emmlyst to paragraphs of r
tell application "Microsoft Excel"
set Value of Range "R1C2" of Sheet 1 of Workbook "Workbook1" to item 1 of emmlyst --NOT 'paragraph of'
end tell
You've used Range "B1:B3". First of all, that's a column with three rows. You can't set its value to one string. You have to set it to a list of a list of 3 strings. Furthermore, Excel X and earlier (which you're using) use the "R1C1" style of address. (Excel 2004 uses "A1" style.) So if you really wanted to set three cells in the column at once, it would be:
set Value of Range "R1C2:R3C2" of Sheet 1 of Workbook "Workbook1" to {{item 1 of emmlyst, item 2 of emmlyst, item 3 of emmlyst}}
Are you trying to put three separate words, one word in each cell? If so, you need to do a lot more parsing, using {" "} as text delimiters.
Otherwise, use "R1C2" (i.e. cell "B1") alone to store the first paragraph.
Maybe you'd better explain what you're trying to do first.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden