Applescript to copy cells from excel and paste into numbers

Hi  community!  I find myself needing your assistance once again.  I'm new to applescript and it's my first scripting language.  I'm trying to create a script that will copy a block of cells in an excel spreadsheet with multiple sheets and paste that info  (preferably with a keystroke) into a numbers template.  I've written a successful script to activate Excel, go to the sheet with the info, copy it, then open a Numbers template from My Templates.  The problem I can't solve on my own is how to select the right cell on the right table on the right sheet and Paste and Match Style.
Some helpful info:
-I've changed my [Command+V] keystroke in Numbers to "Paste and Match Style" because this is a very common action for me
-The Numbers template is pretty big, but does open on the correct sheet for the paste
Here's what I have so far: (sorry for the center justification, but it wasn't displaying correctly)
tell application "Microsoft Excel"
  activate
  set myActiveWook to "OG3.9.xls"
  select worksheet "Blank1"
  select range "E8:E32" of worksheet "Blank1"
  tell application "System Events" to keystroke "c" using command down
  tell application "Microsoft Excel"
  select worksheet "Inputs"
  end tell
  tell application "Numbers"
  activate
  set the templatenames to the name of every template
  set thistemplatename to "PQ10a" as string
  make new document with properties ¬
  {document template:template "PQ10a"}
  end tell
end tell
From here I was trying this, but couldn't get it to work.  it would paste the data the first time into the script editor, then in the middle of the template if run a second time. 
tell application "Numbers"
  activate
  set the templatenames to the name of every template
  set thistemplatename to "PQ10a" as string
  make new document with properties ¬
  {document template:template "PQ10a"}
  tell table "10" of sheet "INPUTS" of document 1
  set selectrange to cell "B2"
  tell application "System Events" to keystroke "v" using command down
  end tell
end tell
+
Thank you in advance for your help. 
Ash

Hey Priya,
The best way to do this would be by utilising the Excel Import Wizard. These help files provide a thorough explanation into their use: 
http://zone.ni.com/reference/en-XX/help/370859J-01/gfsexcel/gfsexcel/dlgexcimp1_dialog/
http://zone.ni.com/reference/en-XX/help/370859J-01/gfsexcel/gfsexcel/dlgexcimp2_dialog/
If you're interested in doing this programatically, this knowledge base article goes through that as well:
http://digital.ni.com/public.nsf/allkb/C9423530C340B77386256F5E0048F369?OpenDocument
Kind Regards,
Shalimar Ali
Applications Engineering Intern

Similar Messages

  • How do I copy image from web and paste into Open Office Document

    Whenever I choose Copy Image from Safari and then paste into open office, I only get the image url and not the image. I am sure that I am not selecting Copy Image Address.
    When I copy images from my iTunes album artwork and paste into open office it works fine.
    Any thoughts?

    I have done the same thing using Firefox and it works just fine. It seems to be an issue with Safari.

  • Why i can't copy massege from excel file paste into illustrator cc?

    it have error box. when i copy many row sentences frow excel files(opensource progremme) and paste into illustrator CC
    i don't know why cause other version can do it

    Ok, it's quite absurd that there's no other workaround for now. I always used Adobe for webdesign, but I think it's time now to go and use some different applications, like Sketch and Macaw. I'm really curious about the last one.
    Thanks anyway for the help:)

  • How can I copy information from Excel and Paste it into a fillable field?

    I have a job site quote fillable packet that I go through when quoting a new job. I also have a fullly detailed excel sheet with all sorts of pricing and data. When I am done filling out the excel sheet, the numbers all compile into a new area that is broken down by phases of the project.
    On the last page of the fillable packet I have an estimate page, a spot where I can input the pricing for each phase of the project, each individual field (there are six) then totals into a fillable field on the bottom of the page.
    Currently I have to select the 6 consecutive cells in excel, open up my PDF, paste the information in a text box, then manually type in each line item.
    Is there a way for me to create a field that I could paste excel sheet data in? Is there a table or some way to paste each cell into one of six text fields?
    Any help would be appreciated!
    Thanks.

    All that should be necessary is to open the ebook, highlight what you wish to copy with the cursor (hold left click, and drag to the end of the section you wish), then either right click and choose copy OR command + c on your keyboard, then move the cursor to the desired section of your Word document, and either right click and choose paste OR command + V to paste the selection.

  • Read data from Excel and write into oracle database

    Hi
    I want  to know how can i read data from excel and write into oracle database using java.Kindly help me out to find a solution.
    Thanks and Regards
    Neeta

    Hai,
    I am suggesting the solution.
    I will try out and let u know soon.
    Make a coma separated file from your excel file.
    Assuming that your requirement allows to make a csv file.
    This file may be passed as an file object to be read by java.Using JDBC you must be able to populate the data base.You can also use String Tokenizer if needed.
    You do not want to  go via sql Loader?
    For reading the excel file itself do you want java?

  • Get the data  from excel and insert into the database

    I want to read the data from excel file, get the data from excel and insert into the database.

    You can use the Apache POI HSSF API to read data from Excel files and you can use the Sun JDBC API to insert data in database.
    This has nothing to do with JSP/JSTL.

  • Can't copy text or images from webpages and paste into word documents or notepad

    Today suddenly I cannot copy text or images from webpages (I tried many different ones) and paste into my word 2010 document or notepad. What can I do to get this ability back. Yesterday it worked fine. It does not appear to be a problem with word or notepad so I have to assume it is a problem with Firefox

    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that temporarily turns off hardware acceleration, resets some settings, and disables add-ons (extensions and themes).
    '''If Firefox is open,''' you can restart in Firefox Safe Mode from the Help menu:
    * Click the menu button [[Image:New Fx Menu]], click Help [[Image:Help-29]] and select ''Restart with Add-ons Disabled''.
    '''If Firefox is not running,''' you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac: Hold the '''option''' key while starting Firefox.
    * On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    When the Firefox Safe Mode window appears, select "Start in Safe Mode".
    ;[[Image:SafeMode-Fx35]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, theme, or hardware acceleration. Please follow the steps in the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.

  • Copying contacts from cc and pasting to bcc

    On ipad 2, iOS 4.x. Apple Mail app.
    My wife accidentally added her contacts to a cc field when she wanted to add it to bcc field. We tried to move the contacts, but that doesn't seem to work. We cannot figure out how to select all the contacts in cc (we were hoping to do that and then cut and paste into bcc). Anybody know a way of doing that?
    Thanks!

    Antti wrote:
    It works alright if I use \n and \t when pasting to Excel, but in Word I'll only get tabs and linechanges.Which is exactly what \n and \t are. So Word's doing that absolutly correctly.
    Can this be done and how?IIRC the clipboard uses RTF to get data in and out of Word. So you'd have to transform your content into an RTF table and put that into the clipboard for Word to read.

  • How can I copy a web image and paste into iMessages?

    I have recently purchased a new iPhone that uses the iOS7.  Previously, I was able to copy images from the web and paste into iMessages.  When I try this now, all that is pasted is the link.  Is there a way around this?

    When I tap and hold the image, I don't see an option to "Save" it.  I get the following options:
    Open, Open in New Page, Add to Reading Lisa, and Copy.  When I choose "copy and then go to paste it, it just pastes the web link as you mentioned.  Am I missing something?
    (Thanks for your response, by the way)!

  • Copy all subform data and paste into another subform

    Need: I would like to have a button within a subform that allows you to copy all the data (many fields) and then paste it into an empty copy of the subform. Of course the info pasted would fill in all the fields etc.
    Reason: We routinely need to move subform data from page 3 in the document to page 11 (example). Currently we insert a new subform and copy/paste each field from 3 to 11 and then delete 3. It would be great to press a copy button in 3 and insert a new subform and paste.into 11.
    Is this possible?

    Steve's advice is good if this is a runtime question - how a user, filling out a form, can copy data from one section of the form to another.
    If this is a buildtime question - how a developer can duplicate a subform to be used elsewhere in the same form or in a different form, you have the following options:
    Duplicate and move. For one off tasks, select the subform in the Hierarchy pallet, and click Ctrl-D. This creates a copy of the subform, with all its contents, which can then be dragged in the hierarchy to its new position.
    Cut and paste. For one off tasks, select the subform in the Hierarchy pallet, and click Ctrl-C. Select the new position in the Hierarchy and then in the Design View (it seems odd to select the same object twice in different pallets, but this is required for the copied subform to be pasted into the right place). Click Ctrl-V
    Fragment. When the exact same subform is going to be used several times in the same and different forms, create a fragment by selecting the subform in the Deisgn View and drag to the Fragment Library pallet. This creates a fragment XDP file. By dragging the fragment onto forms, you are creating links back to the fragment XDP file. Change the fragment and next time you open a form in Designer it will inherit the changes. Fragments cannot be customised for a specific form.
    Common Object. Similar to fragments, you create a common object by selecting the subform in the Deisgn View and drag to the Object Library pallet. The difference is that when you drag a common object onto a form, it is inserting a copy of the subform. The inserted subform is not linked to the common object and so it can be customised for that form and will not inherit changes to the common object.
    Ben Walsh
    www.avoka.com

  • Copying data from a web page into Numbers

    I frequently use a Keyword Density Analysis Tool on the web that displays three columns and perhaps 50 to 100 rows of data. There is no export or save to csv, so I just highlight the three columns, copy and paste into a blank Excel spreadsheet - and hey presto, I get three columns of data. that I can sort and analyse. When I do the same with Numbers I get three columns but all the data ends up in three rows - please see attached. Is there a simple way around this because I am trying to stop using Excel? Thanks./Volumes/garyloch/Public/Screenshots/Picture 2.png
    /Volumes/garyloch/Public/Screenshots/Picture 1.png
    /Volumes/garyloch/Public/Screenshots/Picture 3.png

    The only way I was able to reproduce what you described is to run the script after copying a picture.
    Here is a refined version.
    It make two attempts to grab text items from the clipboard.
    If both failed, it send an error message.
    --[SCRIPT table2text]
    Enregistrer le script en tant qu'Application ou Progiciel : table2text.app
    déplacer l'application créée dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:
    Il vous faudra peut-être créer le dossier Applications.
    Copiez vos données dans le Presse-papiers.
    menu Scripts > table2text
    Le presse-papiers sera alimenté par le composant Text ou utf8 du contenu initial.
    +++++++
    Save the script as an Application or an Application Bundle: table2text.app
    Move the newly created application into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:
    Maybe you would have to create the folder Applications by yourself.
    Copy your block of datas to the Clipboard.
    menu Scripts > table2text
    The Clipboard will be filled with the text or the utf8 component of its original contents.
    Yvan KOENIG (Vallauris, FRANCE)
    4 février 2009
    --=====
    on run
    try
    set the clipboard to (the clipboard as text)
    on error
    try
    set the clipboard to (the clipboard as «class utf8»)
    on error
    if my parleFrancais() then
    error "Pas de données texte dans le presse-papiers !"
    else
    error "No valid text data in the Clipboard !"
    end if
    end try
    end try
    end run
    --=====
    on parleFrancais()
    local z
    try
    tell application theApp to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z = "Annuler")
    end parleFrancais
    --=====
    --[/SCRIPT]
    Yvan KOENIG (from FRANCE mercredi 4 février 2009 21:49:14)

  • Create PDF directly from Excel and paste checkboxes automatically

    Hi,
    I have a problem when creating a PDF. I want to convert a template from Excel into an interactive PDF with text boxes and check boxes. Text fields are automatically generated. Is there a way, to automatically create checkboxes? E.g. I already deliver in Excel a notice that the cell in the PDF form is a checkbox? I use Adobe Acrobat X Pro.
    Sincerely
    Ben

    Is this what you are referring to?
    http://dtputils.com/products/view/2

  • How can I copy text from Pages and paste as Unicode?

    I notice that if I write a Pages document on my iMac (this is Pages 09 running under OSX Mavericks 10.9.1) and copy text that contains characters from the "Mac Roman" character set (like the Greek letter pi for example, and some other mathematical symbols), if I paste it into a text file on a PC (I'm running the Mac with Windows via Parallels), then these characters don't show up correctly. If they were copied as Unicode characters then I don't think the problem would exist. I thought that Pages used Unicode, but it doesn't apparently apply to stuff that gets onto the Mac clipboard. I do know that if I export a whole Pages document it is possible for it to be exported in Unicode, but I just want to copy small bits of text like mathematical formulae and paste them into Unicode-compliant applications. Is this possible? There's nothing in the Pages Preferences to suggest that it is. Is there any solution to this?
    TIA

    Tom, I'm sorry I think I have wasted your time. My initial experiments seemed to show that what I was trying to do didn't work, but now it all seems to work. No idea why. I think there is a problem somewhere, but not where I thought it was. I think what may be happening is that when the Mac clipboard sees some Mac Roman text, it converts and stores it in Unicode form, so things work as long as the receiving app is Unicode aware - or Parallels is doing the job for me, or Pages is. Good if this is true. The only issue then would be that, if a program for the PC is looking for characters by their encodings, it will have to use the Unicode ones to find things, whereas the equivalent code on a Mac will have to look for the Mac Roman encodings as well as Unicode.
    Just to explain, I am not using a specialised mathematical formula editor, but I do expect my user to use the math symbols easily accessible on the Mac keyboard, particularly the Greek letter pi (lower case), division sign, less than or equal to, greater than or equal to, square root. The user can type text directly or paste it in from another application. On the PC side I am not using Microsoft Word but a program I'm developing that can create fields into which I can put text, similar I suppose to NotePad. Just to be able to be cross-platform, I expect users to use the built-in Windows Character Viewer or similar to make the same symbols accessible as in the Mac version.
    If everyone was using Unicode the problem (if there is one) wouldn't exist.
    I may well come back with a similar issue in the future, but my original issue, although the description was given in good faith, seems to be wrong. So I'm saying the problem is solved.

  • Copy text from PDF and paste to imessage

    Before iOS7 I would be able to copy text from a PDF file and paste it normally into a text message or imessage.  Now when doing the same thing it doesn't paste the actual text I copied, but it pastes as an html attachment.  Have I changed a setting or is this just a bug that needs to be fixed?  Please help.

    I get the PDF in an email and open to view it.  Not sure what the pdf opens in automatically, but that is the way I've been doing it since I've had the iphone 4 and haven't had issues until ios7. 
    I just now tried to opened a file in the default view and then switched it to open in Adobe reader and I can copy and paste normally.  So now i have to do an extra step all the time?

  • Unable to copy and paste, I.e. Copy recipes from FaceBook and paste in NOTES.

    I Have an IPad 2 with recently installed IOS 8.02.  I no longer can copy and then paste into NOTES on the IPad.

    No luck unfortunately, BDAqua.
    Did the following:
    1.  Show hidden files
    Did the terminal command as above.
    Force Relaunched Finder.
    All the hidden files appeared.
    The root directory had a /tmp shortcut which pointed to /private/tmp.
    Created a new folder (“untitled folder”) on the Desktop and —
    could copy or move random text files already on the Powerbook's HD to the new folder;
    could not copy–paste or drag–drop files from DVD to the new folder.
    2. Set up new user account
    Created a new user account (“test”) with Administrator privileges.
    Switched to the new user account.
    Created a new folder (“untitled folder”) on the Desktop and —
    could copy or move newly–generated text files from the Desktop to the new folder;
    could not copy–paste or drag–drop files from DVD to the new folder.
    3. Check Desktop info
    Navigated to user root directory.
    Selected Get Info for Desktop folder:
    Desktop folder is not locked;
    Sharing & Permissions privileges for [user] were already set to Read & Write;
    changed the Sharing & Permissions privileges for ‘Everybody‘ from Read Only to Read & Write;
    Force Relaunched Finder.
    Could copy or move files around HD but could not copy files from DVD to HD.

Maybe you are looking for