是否可以从多个Google电子表格中创建一个pdf文件? [英] Is it possible to create a single pdf from multiple Google spreadsheets?

查看:76
本文介绍了是否可以从多个Google电子表格中创建一个pdf文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够从一个Google电子表格工作表

I am able to create a pdf from a single Google spreadsheet sheet using this code.

是否可以调整此代码,以允许将来自不同电子表格的多个工作表合并为一个pdf?还是我需要采取一种完全不同的方法?

Is it possible to tweak this code to allow multiple sheets from different spreadsheets to be merged into a single pdf? Or would I need to take an entirely different approach?

推荐答案

我想您不能,但是您可以轻松地将电子表格合并到一个临时电子表格中,并将其导出为pdf.

I guess you can't but you can easily merge spreadsheets into a temporary spreadsheet and export this one as pdf.

要合并来自不同来源的工作表,您可以选择一种方法,下面是一个小示例,该示例从活动SS中获取一张工作表,从另一个SS中获取一张工作表,然后将其合并为临时" SS.

to merge sheets from different origins you have a choice of methods to choose from, below is a small example that gets 1 sheet from the active SS and one from another SS and merge it in a "temp" SS.

目标电子表格将有3张纸:

The destination spreadsheet will have 3 sheets :

  • sheet1
  • sheet1的副本
  • 工作表1 1的副本

您只需要清理并重命名为您的需求即可.

You'll just have to clean it up and rename to your needs.

代码:

function mergeSS(){
  var dest = SpreadsheetApp.create('temp');
  var s1 = SpreadsheetApp.getActive().getSheets()[0];// one opening method
  var s2 = SpreadsheetApp.openById('1NmeLtT4_9jRzau__________o23KG8hYdJj6w').getSheets()[0];// another opening method
  s1.copyTo(dest);
  s2.copyTo(dest);
}

这篇关于是否可以从多个Google电子表格中创建一个pdf文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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