0

次のような Excel ファイルでセルを取得するコードがあります。

tell application "Microsoft Excel"  
-- put the complete set of data into a list of lists (i.e., 2 dimensions -> columns of rows)
set range1 to range "B2:H7686"
tell active sheet to set myData to value of range1
-- now access a specific cell's data
set myRow to 7
set myCol to 3
set myVal to item {myCol} of item {myRow} of myData as string

end tell

しかし、結果のリストのリストを取得すると、10000.0 より大きい数値は指数形式で表されます。

このスクリプトを実行して、数値を通常の整数形式で取得するか、リスト内の数値を整数形式に変更するにはどうすればよいですか?

補足: これらのリストには、数字と文字列の両方が含まれています

4

2 に答える 2

1

AppleScript Editor は常に、指数表記で小数点の前に 8 桁を超える整数と 4 桁を超える浮動小数点数を表示します。

フロントの Excel スプレッドシートから値を取得する 1 つの方法を次に示します。

tell application "Microsoft Excel"
    tell active sheet
        set x to column 1's row 1's value
    end tell
end tell

値が文字列かどうかを判断する 1 つの方法を次に示します。

set isString to ( x's class is equal to text )
于 2013-03-22T15:55:52.783 に答える
0

試す:

tell application "Microsoft Excel" to set myData to formula of cells of (range "B2:H7686")
于 2013-03-22T16:44:25.963 に答える