[英]Put a “Start” button in Google spreadsheet
I am very a newbie at programming... 我是编程的新手...
I want to insert a button called "Start" in my Google spreadsheet and when I click on it, I want that the date and time at that very moment go in another cell. 我想在Google电子表格中插入一个名为“开始”的按钮,当我单击它时,我希望当时的日期和时间进入另一个单元格。 So the function NOW() should be running and the value of it to be put in another cell... not sure I'm perfectly clear though... Please find attached an image that show how that would work. 因此,函数NOW()应该正在运行,并且它的值应该放在另一个单元格中……不确定我是否很清楚……请找到所附的图片,说明该方法的工作原理。
Thank you so much for you help! 非常感谢您的帮助!
The simple answer is that you can't really use google docs in that way. 简单的答案是,您不能真的那样使用google docs。 The more complicated answer is that you'll need to build an add-on through app scripting: https://developers.google.com/apps-script 更为复杂的答案是,您需要通过应用程序脚本构建附加组件: https : //developers.google.com/apps-script
Google states that their intended replacement of the ui scripting is now html: Google声明,他们打算将ui脚本替换为html:
https://developers.google.com/apps-script/guides/html/ https://developers.google.com/apps-script/guides/html/
so in other words, to make that button, you'll need to make an apps-script add-on and put that in your spreadsheet. 因此,换句话说,要创建该按钮,您需要制作一个apps-script插件并将其放入电子表格中。
I'm not actually in a place where I can check, but there used to be an insert menu where you could put an empty button-looking object on the sheet, then you might be able to attach a more simplified script to that object. 我实际上不在可以检查的地方,但是曾经有一个插入菜单,您可以在该菜单上放置一个空的按钮状对象,然后可以在该对象上附加一个更简化的脚本。 If that isn't around anymore, you'll have to go the apps-script direction. 如果这种情况不再存在,您将必须遵循apps-script的方向。
You can assign an Apps Script function to an image or drawing in Google Sheets, so long as the script is bound to the spreadsheet. 您可以将Apps脚本功能分配给Google表格中的图像或图形,只要脚本已绑定到电子表格即可。 The example below shows how to set this up. 下面的示例显示了如何进行设置。
function startDate() { var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(), cell = 1, col = 1, cellC = 1, colC = 1, rowData = new Date, pasteTo = sheet.getRange(cell, col,cellC,colC).setValue(rowData); }
Please find here the document i'm using for now. 请在这里找到我正在使用的文档。
I definitely think I can improve that, because the problem with those multiple buttons is that my co-workers have to "authorize" the script each time the click on "Start" or "Stop", and that for all the projects. 我绝对认为我可以改善这一点,因为这多个按钮的问题是,每次单击“开始”或“停止”时,我的同事都必须“授权”脚本,并且必须针对所有项目进行“授权”。 So each time a select a task and click start button, it creates a new line in another tab with "Task", "Start time", "End time" 因此,每次选择一个任务并单击“开始”按钮时,它将在另一个选项卡中用“任务”,“开始时间”,“结束时间”创建新行
My ultimate goal would be to have a page with only 3 things - the list of tasks - START button - STOP button 我的最终目标是只有3个页面-任务列表-“开始”按钮-“停止”按钮
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.