Giter VIP home page Giter VIP logo

appsscript's Introduction

AppsScript

Some work with Google Apps Scripts

sheetsToDocs.gs

This takes a Google Spreadsheet of information, and will fill a Google Doc Template that you made.

Steps to Create

  1. Create a New Google Doc
    • I reccomend giving your template a view only access so people don't mess it up
  2. All fields that you want to import, need to be enclosed in double pound signs
    • Example: "##TITLE##"
    • Note: these tags need to be in the BODY of the doc, not header or footer
    • Example:

Screen Shot 2021-06-10 at 10 44 54 AM

  1. Create a New Google Sheet
  2. Add Required Columns:
    • Create Document (Check Box)
    • Document Created (Empty - for now)
    • Document Link (Empty - for now)
    • Doc Name (this will be the name of the doc you will be creating)
  3. Ensure that the column headers (row 1) match your template fields
    • Example:

Google Sheet Setup

  1. Copy this script into your own script editor

Script Editor

  1. Copy over the custom fields
  • ID of your template into line 21 of the script

Edit Template ID

  1. Set up a trigger on edit (important for the automation) 8a) Navigate Here

Trigger

8b) Configure Your Trigger

Note: You can set how often you want to get an update on this script, daily is default

Configure Trigger

  1. New Document will be created in the same folder as your template.
    • The current date willl be appended to the back of your Doc Name.

Completed Sheet and Doc

You now can dynamicly add columns and template tags. As long as they match, they will be imported to your document.

If you aren't seeing the template be filled properly, check that the column name and the tag are exactly the same.

Formating is controlled by the Google Doc, not the sheet, so make sure your format is correct in the template.

You now will see your created document with the forms filled in:

Created Document

How the sheet looks upon completion:

Example Sheet After Script Runs

How it works

The script will trigger when you check the box in the "Create Document" column. It checks for a few things prior to running:

  1. Did you just check this cell ("Create Document")
  2. Is the cell named "Document Created" empty
    • if not, it will not run again
    • this is a great way to create a new template, delete the data in the "Dcoument Created" column, and check the box again
  3. The script creates a copy of your template
    • all properties (including notifications) will be copied over from your template
  4. Then all tagged fields are replaced with the sheet data

Examples

Examples Used

appsscript's People

Contributors

jaceiverson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.