Re: Import txt file in Excel and set cell options
Re: Import txt file in Excel and set cell options
- Subject: Re: Import txt file in Excel and set cell options
- From: David Wignall <email@hidden>
- Date: Thu, 19 May 2011 23:05:35 +1200
On 19 May 2011, at 8:12 PM, Bert Groeneveld wrote: Hello Dave. The tab delimited text files that I want to open in Excel contain lines like: some text tab 20% tab other text tab etc
I need to open these files in Excel so that the cell really reads 20% (what I see and it's underlying value must be the same) in text format (and not general, percentage or whatever).
(I could tell you the reason why I want this, but that is of no interest to the issue)
Hope this is possible.
On 19 mei 2011, at 09:54, David Wignall wrote: On 19 May 2011, at 7:05 PM, Bert Groeneveld wrote: The cell formatting works OK, but it comes in too late. Unfortunately, on opening the txt file "20%" is converted to 0.20. Is there a way to do the formatting before or while opening/importing the txt file? So that the value of 20% is preserved? I need a cell with text formatting containing the value "20%"
You've chosen an interesting example. If my text file has 20% written then Excel 2008 parses this as 0.2 and applies the Percentage format anyway. Do you in fact want Excel to have the string "20%"?
What I found was that if I simply opened a text file with
open alias "Ice:Users:dqw:Desktop:TabTextTest.txt"
then Excel simply opened the file and there was no opportunity given to set formats. Instead of opening the file how about importing it into an existing sheet?
make new query table at active sheet with properties {connection:"TEXT;Ice:Users:dqw:Desktop:TabTextTest.txt", field names:true, text file parse type:delimited, text file tab delimiter:true, text file column data types:{general format, text format}, query type:text import}
refresh query table (query table (1) of active sheet)
I found that I needed to refresh the table in order to get the sheet to update on screen.
-- Dave |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden