通过从Google表格获取数据创建Google文档文件。 [英] Creating Google Docs file by getting data from Google Sheets.

查看:93
本文介绍了通过从Google表格获取数据创建Google文档文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一位经验丰富的程序员,对于使用Google云端硬盘的脚本编辑器没有经验。
由于我需要撰写一些报告,因此我想知道如何利用Google云端硬盘的脚本功能来简化我的过程。



所以我的目标就是我在单词中创建了这种格式,对于词的某些部分,我需要输入每个学生的分数。然而,由于手动操作要求非常高,我想知道如何利用谷歌表格和谷歌文档。

所以我想知道是否有办法让我从电子表格中获取某些数据(每个文档一列),并将这些数字放在Google文档的相应空间中,然后将其保存在谷歌驱动器中或作为电子邮件发送。然后,我将对电子表格中的每一列重复此过程,直到创建所有人的报告。



如果您的专业程序员可以帮助我解决问题,我们将深表感谢。我从来没有任何经验与谷歌脚本编辑器,我不知道从哪里开始。谢谢! google-spreadsheet-data-source /rel =nofollow noreferrer>从Google电子表格数据源生成Google文档的脚本教程。

  / ** 
*根据模板文档和Google电子表格中的数据生成Google文档
*
* License :MIT
*
* Copyright 2013 Mikko Ohtamaa,http://opensourcehacker.com
* /

//从哪里填写数据的行号(以1 =第一行开始)
var CUSTOMER_ID = 1;

//文档模板中的Google Doc id
//(从URL获取ids)
var SOURCE_TEMPLATE =xxx;

//在哪个电子表格中,我们拥有所有客户数据
var CUSTOMER_SPREADSHEET =yyy;

//在哪个Google云端硬盘中我们掷出目标文件
var TARGET_FOLDER =zzz;

/ **
*以JS数组形式返回电子表格行内容。
*
*注意:当我们遇到
*第一个空单元格时,我们假设该行结束。这可能不是
*有时是所需的行为。
*
*行从1开始,而不是零!

I am an experienced programmer who isn't experienced with using the script editor of Google Drive. Since I need to make some reports, I was wondering about ways to exploit the script functionale of Google Drive to ease my process.

So my goal is there's this format that I created in Words, and for some parts of the Words, I need to put in each student's score. However, as doing this manually is very demanding, i was wondering ways to utilize google sheets and google docs for this.

So I was wondering if there's a way for me to get certain data from the spreadsheet (one column for each doc) and put the numbers in the appropriate space in the google docs file, and save it in google drive or send it as an email. Then, I will repeat this process for each column in the spreadsheet until everyone's report has been created.

If you professional programmers can help me out here it will be deeply appreciated. I never had any experience with google script editor and I do not know where to start. Thank you!

解决方案

You may check this Script for generating Google documents from Google spreadsheet data source tutorial.

/**
 * Generate Google Docs based on a template document and data incoming from a Google Spreadsheet
 *
 * License: MIT
 *
 * Copyright 2013 Mikko Ohtamaa, http://opensourcehacker.com
 */

// Row number from where to fill in the data (starts as 1 = first row)
var CUSTOMER_ID = 1;

// Google Doc id from the document template
// (Get ids from the URL)
var SOURCE_TEMPLATE = "xxx";

// In which spreadsheet we have all the customer data
var CUSTOMER_SPREADSHEET = "yyy";

// In which Google Drive we toss the target documents
var TARGET_FOLDER = "zzz";

/**
 * Return spreadsheet row content as JS array.
 *
 * Note: We assume the row ends when we encounter
 * the first empty cell. This might not be 
 * sometimes the desired behavior.
 *
 * Rows start at 1, not zero based!!! 
                        

这篇关于通过从Google表格获取数据创建Google文档文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆