I get a spreadsheet of order data daily that varies in the number of records, but the column structure is always the same. For each spreadsheet, I have to add a return address, that is again, always the same. I’ve come up with a way to place the column name and first row of data in the appropriate place: (names changed to protect the innocent)
tell application "Microsoft Excel"
tell cell "AC1" to set value to "upsaccount"
tell cell "AC2" to set value to "XXXXXX"
tell cell "AD1" to set value to "upscompany"
tell cell "AD2" to set value to "XXXXXX"
tell cell "AE1" to set value to "upsaddress1"
tell cell "AE2" to set value to "XXXXXX"
tell cell "AF1" to set value to "upsaddress2"
tell cell "AF2" to set value to "XXXXXX"
tell cell "AG1" to set value to "upscity"
tell cell "AG2" to set value to "New York"
tell cell "AH1" to set value to "upsstate"
tell cell "AH2" to set value to "New York"
tell cell "AI1" to set value to "upszip"
tell cell "AI2" to set value to "10014"
tell cell "AJ1" to set value to "upscountry"
tell cell "AJ2" to set value to "USA"
tell cell "AK1" to set value to "srpmethod"
tell cell "AK2" to set value to "Ground"
tell cell "AL1" to set value to "billingoption"
tell cell "AL2" to set value to "Third Party"
tell cell "AM1" to set value to "returncompany"
tell cell "AM2" to set value to "XXXXXX"
tell cell "AN1" to set value to "returnname"
tell cell "AN2" to set value to "XXXXXX"
tell cell "AO1" to set value to "returnaddress1"
tell cell "AO2" to set value to "XXXXXX"
tell cell "AP1" to set value to "returnaddress2"
tell cell "AQ1" to set value to "returncity"
tell cell "AQ2" to set value to "Keasbey"
tell cell "AR1" to set value to "returnstate"
tell cell "AR2" to set value to "NJ"
tell cell "AS1" to set value to "returnzip"
tell cell "AS2" to set value to "08832"
end tell
I face two problems I cannot find solutions for. I need to “fill down” the address to every row that is already populated. Secondly, I need to find a way to format the text in column “AS” to zip code or 5-digit number “00000”