AppleScript 和 Numbers:无法为单元格添加值
AppleScript and Numbers: Can't add value to cell
我正在尝试将各种来源的数据合并到 Numbers 中。
我不断收到此错误消息:
Can’t set «class NMCv» of "C30" to 8302.0.
这是我正在使用的子程序:
on addViewsToNumbersSheet(userViews, numbersRow)
tell application "Numbers"
tell front document
tell table 1 of sheet "Doc Data"
log "Row: " & numbersRow
log "Value: " & userViews
set cellC to ("C" & numbersRow as string)
set cellValue to userViews
set value of cellC to cellValue
end tell
end tell
end tell
end addViewsToNumbersSheet
数据打印到日志:
(*Row: 30*)
(*Value: 8302.0*)
我试图只在单元格中放置一个字符串,但我收到了相同的错误消息。我错过了什么?我有一个单独的脚本,我可以用它向同一个 sheet 添加值。
然后我记录了 class,它是 real
。在各种转换工作失败后,我添加了一个返回整数的子例程。我觉得我在这里用火箭筒杀死一只苍蝇。
on convertNumber(userViews)
set aString to userViews as string
set AppleScript's text item delimiters to "."
set aNumber to text item 1 of aString as number
return aNumber
end convertNumber
我以前的脚本现在看起来是这样的:
on addViewsToNumbersSheet(userViews, numbersRow)
tell application "Numbers"
tell front document
tell table 1 of sheet "Prebid Docs"
set convertedNum to my convertNumber(userViews)
set cellC to ("C" & numbersRow as string)
set value of cellC to convertedNum
end tell
end tell
end tell
end addViewsToNumbersSheet
我确实确认 convertedNum 是一个整数。
并且仍然收到错误消息。叹。任何帮助都会很棒。
大图:
我正在从 Google Analytics 中提取视图数据作为 Excel 文件。在我的 Numbers 文件中,我有文档路径和日期,它被添加到 cols A 和 B 的 repo 中。我现在希望 col C 包含此视图数据。我匹配路径(从 GA(在 Excel 中)到 repo 路径(在 Numbers 中)),保存匹配的行(从 Numbers 中)和来自 Excel 的值,并想将该值添加到 Numbers行,C 列
set cellC to cell ("C" & numbersRow as string)
我正在尝试将各种来源的数据合并到 Numbers 中。
我不断收到此错误消息:
Can’t set «class NMCv» of "C30" to 8302.0.
这是我正在使用的子程序:
on addViewsToNumbersSheet(userViews, numbersRow)
tell application "Numbers"
tell front document
tell table 1 of sheet "Doc Data"
log "Row: " & numbersRow
log "Value: " & userViews
set cellC to ("C" & numbersRow as string)
set cellValue to userViews
set value of cellC to cellValue
end tell
end tell
end tell
end addViewsToNumbersSheet
数据打印到日志:
(*Row: 30*)
(*Value: 8302.0*)
我试图只在单元格中放置一个字符串,但我收到了相同的错误消息。我错过了什么?我有一个单独的脚本,我可以用它向同一个 sheet 添加值。
然后我记录了 class,它是 real
。在各种转换工作失败后,我添加了一个返回整数的子例程。我觉得我在这里用火箭筒杀死一只苍蝇。
on convertNumber(userViews)
set aString to userViews as string
set AppleScript's text item delimiters to "."
set aNumber to text item 1 of aString as number
return aNumber
end convertNumber
我以前的脚本现在看起来是这样的:
on addViewsToNumbersSheet(userViews, numbersRow)
tell application "Numbers"
tell front document
tell table 1 of sheet "Prebid Docs"
set convertedNum to my convertNumber(userViews)
set cellC to ("C" & numbersRow as string)
set value of cellC to convertedNum
end tell
end tell
end tell
end addViewsToNumbersSheet
我确实确认 convertedNum 是一个整数。
并且仍然收到错误消息。叹。任何帮助都会很棒。
大图:
我正在从 Google Analytics 中提取视图数据作为 Excel 文件。在我的 Numbers 文件中,我有文档路径和日期,它被添加到 cols A 和 B 的 repo 中。我现在希望 col C 包含此视图数据。我匹配路径(从 GA(在 Excel 中)到 repo 路径(在 Numbers 中)),保存匹配的行(从 Numbers 中)和来自 Excel 的值,并想将该值添加到 Numbers行,C 列
set cellC to cell ("C" & numbersRow as string)