Email templates using data from iWork Numbers spreadsheet

As a photographer, when I get a call from a client to book a shoot, my first step is to open my bookings spreadsheet in Apple's Numbers and input the client's info into pre-determined columns: name, phone number, job date, job scheduled arrival time, job address, job city, travel distance, details regarding the shoot, and then I have a list of columns that specify costs (cost for work, taxes, travel, etc--automatically calculated via functions in spreadsheet).
Immediately after I insert this information into the bookings spreadsheet, I open another file (a text file)--a text template I created to confirm bookings--and fill in the blanks using the information from the spreadsheet. Once that info has been filled out, I copy and paste the entire text file into an an email and email it to the client for his confirmation/records. The email template text (txt) file I use is included below.
Question: Is it possible to create a script that will read the specified row in my Numbers booking spreadsheet (ie, the row where I input the information in the spreadsheet) and have the information inserted into the separate text confirmation template (apple pages or text or email?) at specified areas within the text? If so, can someone help me make something like this? Here's the template I use:
Hi clientnamehere
It was nice chatting with you. And thanks again for choosing us for your photography needs.
For your convenience, I've outlined the details of your booking below. Please ensure everything looks OK:
_Order Confirmation_
As discussed, we've booked the following services:
- [deletethose_that_don't_apply_incl_thisnote]
- real estate photos
- upscaling photos
- virtual tour
- hd video tour
- customizable slideshow
- floor plans
- brochure design, print, & delivery
- virtual staging
- photoshop touchups
For the following location:
- property_address, city, postal_code
On the following date and time:
- month_date at time
Note: If any of the above is incorrect in anyway, please email us asap.
concision edit
Message was edited by: thebigother

Let's begin with your first question:
I've tried to change the "Template.txt" file into an rtf so that I can apply bolding and underlining to certain sections (ie, bolding to the entries like client_name, job_date, etc... and underlining to the "Steps"), and I changed the script from Template.txt to Template.rtf to reflect this change... but when I run a script I get a bug... is there any way to use an rtf file in place of the txt?
The following script should work with an RTF file, provided you don't mind using [GUI Scripting|http://www.macosxautomation.com/applescript/uiscripting/index.html] (in blue below). Before running the script, you will have to enable the Accessibility Frameworks by clicking the checkbox labeled "Enable access for assistive devices" in the Universal Access System Preference pane.
*set theTemplate to POSIX file (POSIX path of (path to desktop) & "Template.rtf")*
*tell application "Numbers"*
*   tell table 1 of sheet 1 of front document*
*      set theValues to value of cells of row 1 of selection range*
*   end tell*
*end tell*
*tell application "TextEdit"*
*   open theTemplate*
*   set theText to text of front document*
*end tell*
*set theText to replace("clientnamehere", item 1 of theValues, theText)*
*set theText to replace("property_address", item 2 of theValues, theText)*
*set theText to replace("city", item 3 of theValues, theText)*
*set theText to replace("postal_code", item 4 of theValues, theText)*
*set theText to replace("month_date", item 5 of theValues, theText)*
*set theText to replace("at time", "at " & item 6 of theValues, theText)*
*tell application "TextEdit"*
   activate
*   tell application "System Events"*
*      keystroke "a" using command down* -- “Select All”
*      keystroke "c" using command down* -- “Copy”
*   end tell*
*   close front document without saving*
*end tell*
*tell application "Mail"*
   activate
*   make new outgoing message with properties {visible:true}*
*   tell application "System Events"*
*      keystroke tab & tab & tab & tab & tab* -- five 5 text fields at most
*      delay 0.25* -- adjust if necessary
*      keystroke "a" using command down* -- “Select All”
*      keystroke "v" using command down* -- “Paste”
*   end tell*
*end tell*
*on replace(X, Y, theText)*
*   set P to offset of X in theText*
*   set L to length of X*
*   tell front document of application "TextEdit"*
*      delete (characters (P + 1) through (P + L - 1))*
*      set character P to Y*
*      return its text*
*   end tell*
*end replace*

Similar Messages

  • Can you transfer data from one numbers spreadsheet to another using conditional formatting?

    I have a tracker document set up for client payments and when I indicate payment received, it  flags green using conditional formatting. However I would like these to automatically transfer to another sheet - without having to cut and paste the associated data to the other sheet. Can I set up conditional formatting to do this? If not how could I get and automatic transfer?
    thanks forum.

    Hi Kangers,
    There are a number of ways to transfer data from one table to the next. It should not be hard to set up.
    Conditional formatting would not be involved it moving the data but you could set it up to flag the data in the new table.
    Without knowing what your tables and data look like it is hard to propose a solution.
    quinn

  • Is there a way to create address labels using data from a Numbers document?

    I'd like to print mailing labels for holiday cards and my wife created the list in a Numbers spreadsheet.
    Is there any way to export to Pages or some other label printing application?
    Thanks.

    Righty-ho. This is based on a spreadsheet like this with named columns in Numbers 3.5. (The rows must be consecutive - the script moves on as soon as it sees an empty row):
    With the spreadsheet open, run the following AppleScript. It will create a group called Christmas List in Contacts, and then import the name and address data from the spreadsheet, adding each person to the group:
    tell application "Numbers" to tell front document to tell active sheet to tell table 1
      set all_contacts to {}
      set row_count to count rows
      repeat with each_row from 2 to row_count
      set nu_contact to {}
      set first_name to value of cell each_row of column "First"
      if first_name is missing value then exit repeat
      copy first_name to end of nu_contact
      copy (value of cell each_row of column "Last") to end of nu_contact
      copy (value of cell each_row of column "Address1") to end of nu_contact
      copy (value of cell each_row of column "Address2") to end of nu_contact
      copy nu_contact to end of all_contacts
      end repeat
    end tell
    tell application "Contacts"
      set group_exists to (every group whose name is "Christmas List")
      if the result is {} then
      make new group at end of groups
      set name of the result to "Christmas List"
      save
      end if
      repeat with each_contact in all_contacts
      activate
      set nu_person to (make new person with properties {first name:item 1 of each_contact, last name:item 2 of each_contact})
      save
      make new address at end of addresses of nu_person with properties {street:item 3 of each_contact, city:item 4 of each_contact}
      save
      add nu_person to group "Christmas List"
      save
      end repeat
    end tell
    Contacts will look like this:
    With the Christmas List group selected in Contacts, go to the Print menu and choose the label format you want:
    Once the labels are printed, select all the names in the Christmas List Group and press the delete key:
    Click the middle "Delete" button and the contacts will be gone.You can then delete the Christmas List group itself.
    This can also be done in Numbers 09, but the script would have to be modified slightly.
    Hope it helps,
    H

  • Automatically create new Excel file from template using data from a selected row in a separate Excel file

    I am fairly new to Macro and VBA in Excel. I am trying to reduce the amount of work involved in a task that is performed often in our office. Currently, the task involves using 2 separate Excel files. One file is a tracking sheet and the second is the document
    that gets sent out to the client. The second document has all the same information that is inserted into the tracking sheet. What I would like to do is have the information that is in one row on the tracking sheet populate into a new excel file that is created
    automatically from an existing template.
    I have been able to make this partially work. What I have been able to achieve is have the cell that is selected in the tracking sheet (the description field) copy into the new file that is created from the template that is on our server.
    Sub NewRFI()
    ' NewRFI Macro
        MsgBox Selection.Address(ReferenceStyle:=xlA1, _
                               RowAbsolute:=False, ColumnAbsolute:=False)
        Selection.Copy
        Workbooks.Add Template:= _
            "template file path goes here"
        Range("C14").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
        Range("C14").Select
        Application.CutCopyMode = False
    End Sub
    What I need to do is get the rest of the information from that same row in the tracking sheet to copy to the new file as well. The other information includes the document number (one cell to the left of the selected cell), who it is from (one cell to the
    right of the selected cell), and the date (two cells to the right of the selected cell). As stated, this information is all in the same row on the tracking sheet. Each piece of information needs to be copied to a certain cell in the new file and I do not want
    the source formatting to be copied to the new file.
    Ideally, I would like it to operate like so: select the first cell in the row (in this case would be the document number field). Then click a button to run the macro that will then copy the information from that row in the tracking sheet to specific cells
    in the new file that is created from the template.
    This process will save us from having to either manually copy and paste the information into the new file or re-type the same information that is already in the tracking sheet.
    This is probably a simple thing to do but it would be great if anybody had some insight on this issue. Thanks in advance!

    Try code like the following. You will have to change the target cells (D25, F1 and H4) to the ones you want, I just used some arbitrary cells as example.
    Sub NewRFI()
    Dim rngCell As Range
    Set rngCell = ActiveCell
    MsgBox Selection.Address(ReferenceStyle:=xlA1, _
    RowAbsolute:=False, ColumnAbsolute:=False)
    Workbooks.Add Template:="template file path goes here"
    Range("C14").Value = rngCell.Value
    ' Change the target cells as needed
    Range("D25").Value = rngCell.Offset(0, -1).Value
    Range("F1").Value = rngCell.Offset(0, 1).Value
    Range("H4").Value = rngCell.Offset(0, 2).Value
    End Sub
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • Filtering using data from a spreadsheet in WebI

    I need to convert a BO6.5 Full client report to a BO XI R3.1 WebI report.  The report needs to use data from an Excel spreadsheet to filter data from a universe, and in 6.5 this was achieved by creating a universe for the spreadsheet data and using 'Select Query Results' as an operand returning this data in the report conditions.  When we put this report through the conversion wizard the conversion fails.
    Are there any other techniques that can be used in WebI that would allow me to use a spreadsheet to filter / join with a query from a 'regular' universe?
    Thanks,
    Steve Clarke

    Thanks for the response! I'd be interested in writing a script for it (I've actually been researching it a bit already). I'm completely new to Javascript (and scripting) but have a fair level of experience with c/c++ so I feel it shouldn't be too bad. I'll ask here for now, just let me know if I should ask a new question on the scripting forum instead.
    I've looked at the Acrobat JavaScript API Reference (http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf) a bit but am having trouble finding a way to read the spreadsheet's data in (I was planning on using a csv file). I found Doc.importTextData(), which can parse a tab delimited file and from the sounds of it fill in the forms automatically (though I would much prefer a c style file interface that lets me write the parsing logic). Every time I try to call importTextData it returns -1 though, which means "Warning: User Canceled File Select". When I call it direct from the JavaScript Debug Console I just get a -1, but when I have it execute when I save I get "NotAllowedError: Security settings prevent access to this property or method.". I did a bit of research on that and modified my script to look like:
    Autofill = app.trustedFunction(
        function ()
            app.trustedFunction(importTextData);
            app.beginPriv();
            var result = this.importTextData("test.csv", 0);
            app.endPriv();
            return result;
    I've also tried running Acrobat as an administrator, but I still get the same error. I could just not be understanding privileges correctly.
    My overall plan was:
        for each row in the spreadsheet
            - read the row in from the file
            - fill out the fields in the PDF using the read data
            - save the file with a new file name.
    If there is a better method to do this, just let me know.
    Thanks again for your time!

  • I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. years each month.

    I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. year each month. I need to create a spreedsheet using the the Acutlas from the year-to-date and from last year-to-date, but need to report each month.

    Hi Tony,
    Answering your question would be easier given a screen shot of the source table and one of what you want the summary table to look like.
    Is the data you want for each month in a single cell o the source table, or does the summary table need to collect February's data (for example) from several cells and do some math with those numbers before presenting them on the summary table?
    Regards,
    Barry

  • Is there a way to import iCal data into a numbers spreadsheet?

    Is there a way to import iCal data into a numbers spreadsheet?

    If you want to import lots of calendar events into Numbers, the general way to proceed would be to:
    export in CSV (character-separated values) from iCal (Calendar)
    import the CSV into Numbers.
    1. can be accomplished via AppleScript (perhaps in an Automator workflow) or, perhaps more convenient, a dedicated exporter app such as Export Calendars Pro or competitors.
    2. Importing into Numbers is usually as easy as File > Open and choose the CSV file.
    SG

  • Extracting data from Microsoft Excel spreadsheet

    Hi,
    I am currently developing an application that requires to extract data from Microsoft Excel spreadsheet. Is that possible to archieve it?
    If it is possible,your precious guidience will be much appreciated.
    Thank you.

    There are several approaches.
    1) Export the data from the Excell in "CSV" format, which is simple enough to read as an ordinary text file.
    2) Use the open source POI package, which reads and writes XSL files (amongst other popular formats).
    3) Use the JDBC/ODBC bridge and the Windows ODBC driver which allows and Excell file to be treated as a database. (More details in above reference).
    4) Use another open source package to connect to Excell via the COM+ interface, and access data therein.
    Personally I favour the POI package.

  • How to get useful data from request?

    Hello.
    I am looking for creating a management tool for a web site. All I want is that is there any ready to use API or package or open source project for retrieving user�s information? I just mean that is there any easy to use way in java to get useful data from a client (for example location, his or her system configuration and information �).
    Thanks.

    If you dump all the data from request (see the javadoc, and especially the "header methods" ) you'll see the data you can get are quite simple.
    The only thing you can try to rely on are ;
    - the IP address from the sender (when reversed to DNS, you can sometime use the tld to locate the country it comes from. Yet, you'll get many .com name, so it's not that significant. it may also give you the IAP used). Note that if the user is using a proxy, it's the proxy IP that you'll collect
    - the User-Agent header : from this, you can guess the OS and the browser used
    - the Referer header : usefull to get where your user comes from (where they found a link to your site)
    - the Cookie header : if you're using a servlet container with session id stored in cookie, you should see the Cookie header appear on the second request to your site. That helps finding out wether your user accep cookie or not (from a server point).
    Besides these, i don't think you can get any other useful data without asking your users on a form. Note that it's the client that decides to send Referer, User-Agent or Cookie headers. Those are not mandatory to the Http Protocole and some browser allow their user to fool their content (butmore than 90% of the widespread browsers don't)

  • How to use data from standard view in Web dynpro for ABAP

    Hello:
    I have to create an Abap Web Dynpro, and I must use data from a standard view in the new one. Does anybody know what do I have to do?
    Thank you and have a happy new year.

    Hi Rodrigo,
    Firstly, list the Standard component under Component Usage of the Component which you are creating in your View.
    Second, In the Custom Component, view, goto context, and try to add the node from the Standard component in to your view.
    NOTE: The second step requires a Node in component controller of the Standard Component.
    Finally, Now in your view, get the data from that and map the data.
    NOTE: To do this, I think you need to call your Standard WDA first and then only your node contains data and it will be passed.
    I hope it is helpful.
    Regards,
    Shashikanth. D

  • Is there a way to export data from a numbers worksheet to address book

    Is there a way to export data from a numbers worksheet to address book

    Yes.  Address Book provides help for this operation:

  • Have a combobox pre-filled using data from database

    What would be a recommended method to have a combobox
    pre-filled using data from database?

    You can load an Array with the data returned from your
    database and bind to that array as the dataProvider for the
    comboBox.
    [Bindable]
    private var myArrayDP:Array = new Array();
    //Load the array with your returned data.
    <mx:ComboBox dataProvider="{this.myArrayDP}">
    </mx:ComboBox>
    Using an ArrayCollection however is often better if you want
    changes to the dataProvider to automatically reflect in the
    ComboBox.

  • Hi, I would like to create a database from my numbers spreadsheet and create reports (like SQL). Is there a way?

    Hi, I would like to create a database from my numbers spreadsheet and create reports (like SQL). Is there a way?

    Numbers is a lightweight spreadsheet.  If you know sql you will know that it can handle many queries and is a real databases that can handle many thousands of records.  Number is not the correct tool.  You can make something that does something like a query but it is not truly a query.
    Can you share anything about the specific application and how much information there is in each record?  How many records (rows)?

  • Does my devices that are on my apple account use data from apple phone

    Will all devices on my apple account use data from my apple phone Grimm at&t.  Snapchat or face time

    Are you referring to cellular data? Is your iPad wifi + cellular? Your iPad cellular is separate from your iPhone cellular account.
    Facetime on an iPad only works on wifi.
    Can you explain your concern?
     Cheers, Tom

  • Does Facetime Use Data From You Data Plan?

    Does Facetime Use Data From You Data Plan?
    If so, what would be a good plan to use :200MB, 2 GB, or 2GB + Tethering?
    Or Does it use up minutes?

    Facetime uses wi-fi.
    "People have been dreaming about video calling for decades. iPhone 4 makes it a reality. With just a tap, you can wave hello to your kids, share a smile from across the globe, or watch your best friend laugh at your stories — iPhone 4 to iPhone 4 or to the new iPod touch over Wi-Fi."
    http://www.apple.com/iphone/features/

Maybe you are looking for