Re: Read a cell in Excel 2004
Re: Read a cell in Excel 2004
- Subject: Re: Read a cell in Excel 2004
- From: Nan Mossey <email@hidden>
- Date: Wed, 10 Nov 2004 16:21:31 -0500
I'm up and running. String value worked for my currency data ( I was
surprised that my Pan V database accepted it with the $ in place, but it
did), and short date string got me the date I needed.
Thanks a lot for your time and advice. My whole production process works
through scripts, so your quick solutions meant the world to me.
On 11/10/04 3:22 PM, "Paul Berkowitz" <email@hidden> wrote:
> At first glance, I don't see anything that returns the type of format of the
> cell values. I'm pretty sure that something like that _should_ be available,
> but I don't know where. If it doesn't exist, I'll see if it can be added. I
> would have thought that 'currency' would be a sub-set of number values,
> which are 'real' data type in AppleScript. It sounds as if there's
> something wrong with 'currency' format values. I'll have to do some
> comparative testing of real, integer and currency values, and then I'll
> report any bugs I find. MS is committed to fixing AppleScript bugs for later
> releases.
>
> Note that you can text the class of the value you receive back (when you do
> get a value). So if the class is date, you can get the short date. If the
> class is real, you can coerce it 'as string'. You might first want to coerce
> it to integer if it is a whole number:
>
> set theValue to value of cell "B3" -- 3.0
> if class of theValue if real then
> try
> set theValue to theValue as integer -- 3
> end try -- if 3.75, it remains as is
> set theValue to theValue as string -- "3" 0r "3.75"
> else if class of theValue is date then
> set theValue to short date string of theValue
> else if theValue = missing value
> -- some error routine here
> else if class of theValue is Unicode text then
> set theValue to theValue as string -- ?
> --else if -- ??
> end if
>
>
> Even for text, since Excel returns Unicode text, you may need to coerce it
> to string for some other apps. I answer to an earlier question of yours
>
> string value of cell "B3"
>
> will always get you a string (like 'text of cell' did in Excel X), but in
> the case of dates you get that long verbose date & time, so this is not the
> way to go.
--
Nan Mossey
Times Union Publications Manager
1 News Plaza
Albany NY 12212
518-454-5704
========================================================
This e-mail message is intended only for the personal
use of the recipient(s) named above. If you are not
an intended recipient, you may not review, copy or
distribute this message.
If you have received this communication in error,
please notify the Albany Times Union Help Desk
(email@hidden) immediately by e-mail and
delete the original message.
========================================================
_______________________________________________
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