Untitled
unknown
plain_text
2 years ago
1.8 kB
3
Indexable
set numbersFile to "path/to/your/Numbers/file.numbers" set pdfFormTemplate to "path/to/your/PDF/form_template.pdf" set outputFolder to "path/to/your/output/folder/" tell application "Numbers" activate open numbersFile tell document 1 repeat with i from 2 to 101 -- Assuming the data starts from row 2 and you want to process 100 records set nameValue to value of cell "A" & i set addressValue to value of cell "B" & i set leaseExpValue to value of cell "C" & i set leaseStartValue to value of cell "D" & i set rentAmountValue to value of cell "E" & i set securityDepositValue to value of cell "F" & i set pdfForm to read pdfFormTemplate set pdfForm to replaceText("[[Name]]", nameValue, pdfForm) set pdfForm to replaceText("[[Address]]", addressValue, pdfForm) set pdfForm to replaceText("[[LeaseExp]]", leaseExpValue, pdfForm) set pdfForm to replaceText("[[LeaseStart]]", leaseStartValue, pdfForm) set pdfForm to replaceText("[[RentAmount]]", rentAmountValue, pdfForm) set pdfForm to replaceText("[[SecurityDeposit]]", securityDepositValue, pdfForm) set outputFileName to (outputFolder & nameValue & ".pdf") write pdfForm to file outputFileName end repeat end tell end tell on replaceText(findText, replaceText, sourceText) set AppleScript's text item delimiters to the findText set the sourceText to the text items of sourceText set AppleScript's text item delimiters to the replaceText set sourceText to the sourceText as string set AppleScript's text item delimiters to "" return sourceText end replaceText
Editor is loading...