Google apps script 使用链接从文件发送值
我来这里是想问你一些关于Google Sheets宏的事情,Google apps script 使用链接从文件发送值,google-apps-script,google-sheets,google-sheets-macros,Google Apps Script,Google Sheets,Google Sheets Macros,我来这里是想问你一些关于Google Sheets宏的事情, 我想将信息从Google工作表文件发送到另一个文件。 我想,当我点击链接时,它会将同一行的值发送到另一行 文件。只需粘贴到code.gs并运行showSideBar函数。请注意侧边栏顶部提供的说明,一切都应该正常工作 function sendCurrentRow() { var tssid='target spreadsheet id';//put the target spreadsheet id here const s
我想将信息从Google工作表文件发送到另一个文件。
我想,当我点击链接时,它会将同一行的值发送到另一行
文件。只需粘贴到code.gs并运行showSideBar函数。请注意侧边栏顶部提供的说明,一切都应该正常工作
function sendCurrentRow() {
var tssid='target spreadsheet id';//put the target spreadsheet id here
const ss=SpreadsheetApp.getActive();
const sh=ss.getActiveSheet();
const rg=sh.getActiveRange();
const row=sh.getRange(rg.getRow(),1,1,sh.getLastColumn()).getValues();
const tss=SpreadsheetApp.openById(tssid);
var tsh=tss.getSheetByName(sh.getName());
if(!tsh) {
var tsh=tss.insertSheet(sh.getName())
}
tsh.getRange(rg.getRow(),1,1,sh.getLastColumn()).setValues(row);
}
function showSideBar() {
var html='<p>If you haven put you target spreadsheet id in function sendCurrentRow() then do before pressing button below.</p><p>Place cursor on the row you wish to send and click button below.</p><br />'
html+='<input type="button" value="Send" onClick="google.script.run.sendCurrentRow()" />';
SpreadsheetApp.getUi().showSidebar(HtmlService.createHtmlOutput(html).setTitle('Send Current Row'));
}
函数sendCurrentRow(){
var tssid='target spreadsheet id';//将目标电子表格id放在此处
const ss=SpreadsheetApp.getActive();
const sh=ss.getActiveSheet();
const rg=sh.getActiveRange();
常量行=sh.getRange(rg.getRow(),1,1,sh.getLastColumn()).getValues();
const tss=电子表格应用程序openById(tssid);
var tsh=tss.getSheetByName(sh.getName());
如果(!tsh){
var tsh=tss.insertSheet(sh.getName())
}
tsh.getRange(rg.getRow(),1,1,sh.getLastColumn()).setValues(row);
}
函数showSideBar(){
var html='如果您尚未将目标电子表格id放入函数sendCurrentRow()中,请在按下下面的按钮之前执行此操作。将光标放在要发送的行上,然后单击下面的按钮。
html+='';
SpreadsheetApp.getUi().showSidebar(HtmlService.createHtmlOutput(html.setTitle('Send Current Row'));
}
只需粘贴到code.gs并运行showSideBar函数。请注意侧边栏顶部提供的说明,一切都应该正常工作
function sendCurrentRow() {
var tssid='target spreadsheet id';//put the target spreadsheet id here
const ss=SpreadsheetApp.getActive();
const sh=ss.getActiveSheet();
const rg=sh.getActiveRange();
const row=sh.getRange(rg.getRow(),1,1,sh.getLastColumn()).getValues();
const tss=SpreadsheetApp.openById(tssid);
var tsh=tss.getSheetByName(sh.getName());
if(!tsh) {
var tsh=tss.insertSheet(sh.getName())
}
tsh.getRange(rg.getRow(),1,1,sh.getLastColumn()).setValues(row);
}
function showSideBar() {
var html='<p>If you haven put you target spreadsheet id in function sendCurrentRow() then do before pressing button below.</p><p>Place cursor on the row you wish to send and click button below.</p><br />'
html+='<input type="button" value="Send" onClick="google.script.run.sendCurrentRow()" />';
SpreadsheetApp.getUi().showSidebar(HtmlService.createHtmlOutput(html).setTitle('Send Current Row'));
}
函数sendCurrentRow(){
var tssid='target spreadsheet id';//将目标电子表格id放在此处
const ss=SpreadsheetApp.getActive();
const sh=ss.getActiveSheet();
const rg=sh.getActiveRange();
常量行=sh.getRange(rg.getRow(),1,1,sh.getLastColumn()).getValues();
const tss=电子表格应用程序openById(tssid);
var tsh=tss.getSheetByName(sh.getName());
如果(!tsh){
var tsh=tss.insertSheet(sh.getName())
}
tsh.getRange(rg.getRow(),1,1,sh.getLastColumn()).setValues(row);
}
函数showSideBar(){
var html='如果您尚未将目标电子表格id放入函数sendCurrentRow()中,请在按下下面的按钮之前执行此操作。将光标放在要发送的行上,然后单击下面的按钮。
html+='';
SpreadsheetApp.getUi().showSidebar(HtmlService.createHtmlOutput(html.setTitle('Send Current Row'));
}
欢迎光临。请阅读并添加您的搜索/研究工作的简要说明,如中所述。关于当我单击链接时,它会将同一行的值发送到另一个文件
,我无法理解您所期望的链接
。例如,您正在考虑Web应用程序或其他应用程序?我认为使用复选框作为运行脚本的开关可能适合您的情况。这个怎么样?欢迎。请阅读并添加您的搜索/研究工作的简要说明,如中所述。关于当我单击链接时,它会将同一行的值发送到另一个文件
,我无法理解您所期望的链接
。例如,您正在考虑Web应用程序或其他应用程序?我认为使用复选框作为运行脚本的开关可能适合您的情况。这个怎么样?谢谢你的帮助,我很感激谢谢你的帮助,我很感激D