我有一个Applescript将XLSX转换为XLS。我可以从Google Team Drive获取文件(通过Drive File Stream),将其转换并保存到我的桌面上。当我尝试将其保存到Google Team Drive上的“ Out”文件夹时,出现错误。
我认为我的输出路径不正确。我尝试过其他方法来达到目标,但是没有运气。
将工作代码保存到桌面:
set {year:y, month:m, day:d, time:t} to (current date)
set today to (m as number) & d & y
set TSCfilein to "Volumes:GoogleDrive:Team Drives:Sales:Customer Service:Inventory Feeds:TSC:In:TSC_Master.xlsx"
set TSCfileout to (path to desktop as text) & "TSC" & today & ".xls" as string
tell application "Microsoft Excel"
activate
open file TSCfilein
tell workbook 1
tell sheet 1
save active workbook in TSCfileout as Excel98to2004 file format
end tell
close without saving
end tell
end tell
将TSCfileout设置更改为以下会导致错误:
set TSCfileout to "Volumes:Google Drive:Team Drives:Sales:Customer Service:Inventory Feeds:TSC:Out" & "TSC" & today & ".xls" as string
预期结果是保存文件Google Team Drive文件夹。
错误:
“ Microsoft Excel出现错误:工作簿1的工作表1的活动工作簿无法理解“保存”消息。”当我尝试指向输出文件的位置时。
答案 0 :(得分:0)
有一个普遍的误解:HFS路径总是以磁盘名称开始,而始终,但从不以Volumes
开头。
请勿将其与POSIX路径混淆。
/
作为HFS路径Macintosh HD
/Volumes/Google Drive
的{{1}} Google Drive
您通往外部卷的路径是
Out
尾随强制set TSCfileout to "Google Drive:Team Drives:Sales:Customer Service:Inventory Feeds:TSC:Out:" & "TSC" & today & ".xls"
是多余的。根据规则,最左边的类型是连接的结果类型。