• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Scripting Numbers a Little More – Extracting Data into an Array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scripting Numbers a Little More – Extracting Data into an Array


  • Subject: Scripting Numbers a Little More – Extracting Data into an Array
  • From: Christopher Stone <email@hidden>
  • Date: Mon, 06 Feb 2017 20:59:50 -0600

Hey Folks,

Okay, this is what I'm fooling with at the moment, and it's working well enough.

( Although if anyone has some good tips I'm all eyes and ears. :)

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/02/06 17:01
# dMod: 2017/02/06 19:42 
# Appl: Numbers
# Task: Extract Formatted Data from Cells.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Numbers, @Extract, @Formatted, @Data, @Cells
# Vers: 1.00
-------------------------------------------------------------------------------------------

tell application "Numbers"
   if document 1 exists then
      tell document 1
         tell active sheet

            

            try
               set activeTable to (the first table whose class of selection range is range)
            on error
               error "Something is wrong with the selection in the front document."
            end try

            

            tell activeTable
               set rowList to rows of selection range
               repeat with theRow in rowList
                  set contents of theRow to formatted value of cells of theRow
               end repeat
            end tell

            

         end tell
      end tell
   end if
end tell

repeat with theRow in rowList
   repeat with theCell in theRow
      if (contents of theCell) is missing value then
         set contents of theCell to ""
      end if
   end repeat
end repeat

rowList

-------------------------------------------------------------------------------------------

If you don't iterate through the rows and just get the value of the cells of the selection, you end up with a flat list (which will work fine for some tasks of course).

--
Best Regards,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Scripting Numbers a Little More – Extracting Data into an Array
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Scripting Numbers Just a Little
  • Next by Date: List Archives Dead in the Water
  • Previous by thread: Re: Scripting Numbers Just a Little
  • Next by thread: Re: Scripting Numbers a Little More – Extracting Data into an Array
  • Index(es):
    • Date
    • Thread