0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【備忘録】numbers2csv(カレントディレクトリのnumbersをcsvに変換する)

0
Posted at

カレントディレクトリのnumbersのファイルを一括して、csvに変換する方法を紹介する。
変換したいファイルのあるディレクトリに移動し、以下のコマンドをターミナルで実行する。

find . -name "*.numbers" -print0 | while IFS= read -r -d '' f; do
  # 絶対パスに変換
  abs_in="$(cd "$(dirname "$f")"; pwd)/$(basename "$f")"
  abs_out="${abs_in%.numbers}.csv"

  echo "Converting: $abs_in -> $abs_out"

  osascript -e 'on run argv
      set inPath to item 1 of argv
      set outPath to item 2 of argv
      set inAlias to POSIX file inPath as alias
      set outFile to POSIX file outPath
      tell application "Numbers"
          set theDoc to open inAlias
          delay 0.5
          export theDoc to outFile as CSV
          close theDoc saving no
      end tell
  end run' "$abs_in" "$abs_out"
done
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?