Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/germabyte/docmerge
DocMerge is a Google Apps Script that automatically creates personalized documents by replacing placeholder text with custom values from a spreadsheet. It's perfect for generating multiple customized documents like contracts, letters, or certificates without manual editing.
https://github.com/germabyte/docmerge
automation document-generator google-apps-script google-docs google-drive google-sheets gscript template-engine text-replacement
Last synced: about 22 hours ago
JSON representation
DocMerge is a Google Apps Script that automatically creates personalized documents by replacing placeholder text with custom values from a spreadsheet. It's perfect for generating multiple customized documents like contracts, letters, or certificates without manual editing.
- Host: GitHub
- URL: https://github.com/germabyte/docmerge
- Owner: germabyte
- Created: 2025-01-02T22:46:25.000Z (25 days ago)
- Default Branch: main
- Last Pushed: 2025-01-04T13:39:32.000Z (24 days ago)
- Last Synced: 2025-01-10T02:23:08.815Z (18 days ago)
- Topics: automation, document-generator, google-apps-script, google-docs, google-drive, google-sheets, gscript, template-engine, text-replacement
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DocMerge
DocMerge is a Google Apps Script that automatically creates personalized documents by replacing placeholder text with custom values from a spreadsheet. It's perfect for generating multiple customized documents like contracts, letters, or certificates without manual editing.
## What It Does
The script takes a template Google Document containing placeholders (like `${name}` or `${date}`) and replaces them with corresponding values from a Google Spreadsheet. This automation helps:
- Save time when creating multiple personalized documents
- Reduce errors from manual copy-pasting
- Maintain consistency across all generated documents### How Placeholders Work
The script recognizes placeholders in this format: `${placeholder_name}`
For example:
- `${name}` might become "John Smith"
- `${date}` might become "January 4, 2025"The script is smart enough to handle nested placeholders, meaning it will keep replacing placeholders until no more remain in the document. This is particularly useful when dealing with complex templates where one replacement might reveal another placeholder.
## Getting Started
### What You'll Need
1. A Google account
2. A template Google Document with placeholders
3. A Google Spreadsheet with your replacement values
4. The DocMerge script### Setup Instructions
1. Download the repository ZIP file from this page
2. Open Google Apps Script by visiting script.google.com
3. Create a new project
4. Copy the contents of `docmerge.gs` into your new project
5. Update these variables in the script:
- `sheetId`: Your Google Spreadsheet ID
- `templateDocId`: Your template Google Document ID
- `outputFolderId`: The Google Drive folder ID where new documents will be saved### Preparing Your Data
1. Create a Google Spreadsheet with two rows:
- First row: Your placeholder names (without the ${} symbols)
- Second row: The corresponding values
2. Name the spreadsheet tab "docvars"## Example Use Case
Imagine creating personalized offer letters:
Template text:
```
Dear ${candidate_name},We are pleased to offer you the position of ${job_title} at ${company_name},
starting on ${start_date} with an annual salary of ${salary}.Best regards,
${manager_name}
```Spreadsheet setup:
```
candidate_name | job_title | company_name | start_date | salary | manager_name
John Smith | Senior Dev | TechCorp | 2025-02-01 | $120,000 | Jane Wilson
```The script will generate a new document with all placeholders replaced with the corresponding values.
## Important Notes
This repository and its documentation may be updated at any time. While efforts are made to keep documentation accurate, there is no guarantee that this README will be immediately updated to reflect all changes in the repository.
The script requires appropriate Google Drive permissions to:
- Read from the specified spreadsheet
- Access the template document
- Create new documents in the output folderFor better performance, consider limiting the size of your spreadsheet to only the rows and columns you need.