简体   繁体   English

使用 Google 脚本从 Google 表格上的特定单元格命名新表格

[英]Naming a New Sheet with Google Scripts from a specific cell on a Google Sheet

trying to figure out how to give a new sheet that is copied into a folder a specific name each time from a button script.试图弄清楚如何为每次从按钮脚本复制到文件夹中的新工作表提供特定名称。 The specific name would come from a specific cell each time.特定名称每次都来自特定单元格。

Here's the current code being used and the New Sheet is what I'm trying to have named from cell B3 on a specific spreadsheet each time.这是当前正在使用的代码,新工作表是我每次尝试从特定电子表格上的单元格 B3 中命名的内容。 No idea how to do this, it just names it NEW SHEET each time and then errors out when I try to do B3.不知道如何做到这一点,它每次都将其命名为 NEW SHEET,然后在我尝试执行 B3 时出错。

function cloneGoogleSheet() {
  var destFolder = DriveApp.getFolderById("Folder Name"); 
  DriveApp.getFileById("Folder Name").makeCopy('NEW SHEET', destFolder); 
 SpreadsheetApp.getActive().getSheetByName('NEW SHEET').setName('Specific Sheet!B3')
}

Any help is appreciated!任何帮助表示赞赏!

function cloneGoogleSheet() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getActiveSheet();
  const name = sh.getRange('A1').getDisplayValue();
  const destFolder = DriveApp.getFolderById("Folder Id"); 
  DriveApp.getFileById("file id").makeCopy(name, destFolder); 
}

Get used to using file id's and not names.习惯使用文件 ID 而不是名称。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 特定工作表和特定单元格中的Google工作表Duplicatea特定工作表 - Google sheet Duplicatea specific sheet from a specific sheet and specific cell Google文件-指令码,将储存格从一张工作表复制到另一张工作表 - Google Docs - Scripts, copy cell from one sheet to another sheet Google Spreadsheet-脚本,每天在特定时间将单元格从一张工作表复制到另一张工作表 - Google Spreadsheet - Scripts, copy cell from one sheet to another sheet EVERYDAY at a specific time 在谷歌工作表中定义特定单元格 - define specific cell in google sheet 如何使用新的 Google 电子表格的数据填充特定工作表中的单元格 - How to fill a cell in a specific sheet with data of new Google spreadsheets 如何以编程方式从谷歌脚本打开一个新的电子表格 - how to programmatically open a new spread sheet from google scripts 使用第三张工作表中的单元格值将Google工作表复制到新工作表中 - Copy Google sheet to a new sheet using cell value from 3rd sheet 获取特定表的谷歌电子表格的字体单元格和背景色单元格 - getting font cell and backcolor cell of a specific sheet of google spread sheet Google Apps Scripts / Google Sheet - 禁用所有活动过滤器,显示特定单元格并根据条件再次过滤 - Google Apps Scripts / Google Sheet - Disable all the active filters, Show a specific cell and filter again based on criteria Google Sheets + Apps Scripts,从一个工作表复制/粘贴到另一个工作表,但粘贴到特定列 (B) 中的第一个空单元格 - Google Sheets + Apps Scripts, Copy/Paste from one sheet to another, but Paste into first empty cell in specific column (B)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM