How to write to spreadSheet column(Excel) using Egg Plant

Hi ,

I’ve a bunch of jobs in the spread sheet and i need to write my files to specified column’s in the spreadsheet

Example :

My Spreadsheet will have column headers like

ID Name Age Company

and i have declared variables like

global ID,Name,Age,Company

my data driven script should write the values stored in variables to the respective columns

Please help me out to automate this scenario using Egg Plant…

Thanks In Advance

Here’s a script that works for me. I have a spreadsheet with column headers in row 1. This script enters values from variables in the script into the columns with the same name.

-- A script to enter data into an Excel spreadsheet from local variables

-- set some local variables whose values will be entered in the spreadsheet
set (id, name, age, company) to (1234,"Billy Williams", 42, "Acme, Inc.")

-- read the headers
do AppleScript {{
tell application "Microsoft Excel"
open "Macintosh HD:Users:doug:temp:Sample.xls"
get value of the used Range of worksheet 1
end tell
put the result into data
put item 1 of data into headers -- item 1 is the first row
repeat with each item of headers
	insert value(it) after values -- put values in same order as column names
end repeat
-- get the letter for the last column of the destination range
set count to the number of items in values
put char count of "ABCDEFGHIJKLMNOPQRSTUVWXYZ" into lastColumn

set rowNum to the number of items in data + 1 -- the next empty row

-- store the values:
do AppleScript merge of {{
tell application "Microsoft Excel"
open "Macintosh HD:Users:doug:temp:Sample.xls"
set value of range "A[[rowNum]]:[[lastColumn & rowNum]]" of worksheet 1 to [[values.standardFormat]]
end tell

This script enters values into the next available row of the spreadsheet. The columns can be in any order. You’ll need to replace the path to the spreadsheet with the correct path on your system.