• 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
Re: Extract Text From Spreasheets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Extract Text From Spreasheets


  • Subject: Re: Extract Text From Spreasheets
  • From: Christopher Stone <email@hidden>
  • Date: Tue, 13 Jul 2004 12:51:12 -0500

At 11:42 -0400 07/13/2004, email@hidden wrought:

Would some one please assist me. I have a excell spreadsheet, which I have to manually extract text from cells. How do I take text from say the first 10 lines of the spreadsheet, copy that text, disregarding the cells, and placing the extracted text into a text document. However, here is the rub. The contents of each cell must have a return after each entry.

I don't script Excel except once in a blue moon, so there're probably some neat tricks I'm unaware of - nevertheless...

This will do as you describe:

[Excel 11.0.0]

----------------------------------------------------------------------
tell application "Microsoft Excel"
tell active sheet
set dta to value of range "a1:e10"
end tell
end tell

set AppleScript's text item delimiters to {return}
repeat with i in dta
set i's contents to i as string
end repeat
set AppleScript's text item delimiters to {return & return}
set dta to dta as string
set AppleScript's text item delimiters to {""}

tell application "Tex-Edit Plus"
make new document with properties {name:"Excel Export", position:{0, 44}, contents:dta}
activate
end tell
----------------------------------------------------------------------

If you don't have Tex-Edit Plus, why don't you? ;-)

http://tex-edit.com/

The script assumes a fixed range size - row 1 through 10 of the active sheet by 5 columns.

If your data is variable it shouldn't be too hard to define the length and width of the range.

You can write the text to Tex-Edit Plus, BBEdit, TextEdit, etc., or you could write directly to a file.

Holler if you need more help.

[Paul - you got any tricky VBScript to make this easier?]


Chris
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


References: 
 >Extract Text From Spreasheets (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: Launching an AppleScript from a Local Browser Page
  • Next by Date: Re: Extract Text From Spreasheets
  • Previous by thread: Extract Text From Spreasheets
  • Next by thread: Re: Extract Text From Spreasheets
  • Index(es):
    • Date
    • Thread