- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
从原始内容编辑我正在尝试找出如何以表格格式检索和报告为每位客人重复的日历事件的详细信息,以便可以将信息转换为简单的打印-每次事件的参加者登记册。
我收到有关范围高度的错误 - 我的代码确实为每个 guest 创建了每个事件的日志(因此我可以看到它正确编译信息),但它不会将其输出到单独的行。错误是“范围高度不正确,为 1,但应为 7”。
我的代码如下。我评论它是为了清楚地说明每一部分应该做什么:
function onOpen()
{
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Get Calendar Info",
functionName : "getCal"
}];
sheet.addMenu("Calendar Actions", entries);
}
function getCal()
{
// Export Google Calendar Events to a Google Spreadsheet, one row for each guest
//
// This code retrieves events and guests between 2 dates for the specified calendar.
// It logs the results in the current spreadsheet starting at cell A2 listing the events,
// dates/times, etc and also calculates event duration (via creating formulas in the spreadsheet).
// Reference Websites:
// https://developers.google.com/apps-script/reference/calendar/calendar
// https://developers.google.com/apps-script/reference/calendar/calendar-event
var mycal = "myemailaddress"; //this is the email address of whichever Google account is to use this
var cal = CalendarApp.getCalendarById(mycal);
var guestEmail = "";
var guestStatus = "";
var guestName = "";
//var startDate = Browser.inputBox("Start Date, in format MM / DD / YYYY");
//var endDate = Browser.inputBox("End Date, in format MM / DD / YYYY");
//var startDate = "September 25, 2015 00:00:00 CST";
//var endDate = "September 26, 2015 23:59:59 CST";
//var events = cal.getEvents(new Date("September 25, 2015 00:00:00 CST"), new Date("October 01, 2015 23:59:59 CST"), {search: '-project123'});
var events = cal.getEvents(new Date("September 25, 2015 00:00:00 CST"), new Date("October 22, 2015 23:59:59 CST"));
//var events = cal.getEvents(new Date(startDate), new Date(endDate));
var sheet = SpreadsheetApp.getActiveSheet();
// Uncomment this next line if you want to always clear the spreadsheet content before running - Note people could have added extra columns on the data though that would be lost
sheet.clearContents();
// Create a header record on the current spreadsheet in cells A1 onwards - Match the number of entries in the "header=" to the last parameter
// of the getRange entry below
var header = [["Calendar Address", "Event Title", "Event Description", "Event Location", "Event Start", "Event End", "Calculated Duration", "Visibility", "Date Created", "Last Updated", "MyStatus", "Created By", "All Day Event", "Recurring Event", "ID","Email","Status","Name"]]
var range = sheet.getRange(1,1,1,18);
range.setValues(header);
// Loop through all calendar events found and write them out starting on calulated ROW 2 (i+2)
for (var i=0;i<events.length;i++)
{
var row=i+2;
var myformula_placeholder = '';
// Matching the "header=" entry above, this is the detailed row entry "details=", and must match the number of entries of the GetRange entry below
Logger.log("Event "+i+": "+events[i].getId());
var guestList=events[i].getGuestList(); //GET THE EMAIL AND STATUS OF EACH GUEST FOR EACH EVENT
for(var d=0; guestList!=null && d<guestList.length; d++)
{
guestEmail = guestList[d].getEmail();
guestStatus = guestList[d].getGuestStatus();
guestName = guestList[d].getName();
Logger.log("Guest "+d+": "+guestList[d].getEmail()+", Status: "+guestList[d].getGuestStatus());
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), events[i].getStartTime(), events[i].getEndTime(), myformula_placeholder, ('' + events[i].getVisibility()), events[i].getDateCreated(), events[i].getLastUpdated(), events[i].getMyStatus(), events[i].getCreators(), events[i].isAllDayEvent(), events[i].isRecurringEvent(), events[i].getId(), guestList[d].getEmail(), guestList[d].getGuestStatus(), guestList[d].getName()]];
Logger.log(details);
var range = sheet.getRange(row,1,guestList.length,18);
range.setValues(details);
// Writes the formula out to calculate number of hours, for the specific row, in column 7 to match the position of the field myformula_placeholder from above.
var cell = sheet.getRange(row,7);
cell.setFormula('=(HOUR(F' +row+ ')+(MINUTE(F' +row+ ')/60))-(HOUR(E' +row+ ')+(MINUTE(E' +row+ ')/60))');
cell.setNumberFormat('.00');
}
}
}
最佳答案
在一位出色的学者的帮助下,我完成了我的代码,并且它完全按照要求运行。下面发布了最终代码以帮助其他人。
function onOpen()
{
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Get calendar info",
functionName : "getCal"
}];
sheet.addMenu("Calendar Actions", entries);
}
// Export Google Calendar Events to a Google Spreadsheet, one row for each guest
//
// This code retrieves events between 2 dates for the specified calendar including all guests included in the event.
// It logs the results in the current spreadsheet starting at cell A2 listing the events,
// dates/times, etc and also calculates event duration (via creating formulas in the spreadsheet) and formats the values.
//
// Reference Websites:
// https://developers.google.com/apps-script/reference/calendar/calendar
// https://developers.google.com/apps-script/reference/calendar/calendar-event
function getCal()
{
// Export Google Calendar Events to a Google Spreadsheet, one row for each guest
//
// This code retrieves events between 2 dates for the specified calendar.
// It logs the results in the current spreadsheet starting at cell A2 listing the events,
// dates/times, etc and even calculates event duration (via creating formulas in the spreadsheet) and formats the values.
//
// I do re-write the spreadsheet header in Row 1 with every run, as I found it faster to delete then entire sheet content,
// change my parameters, and re-run my exports versus trying to save the header row manually...so be sure if you change
// any code, you keep the header in agreement for readability!
//
// 1. Please modify the value for mycal to be YOUR calendar email address or one visible on your MY Calendars section of your Google Calendar
// 2. Please modify the values for events to be the date/time range you want and any search parameters to find or omit calendar entires
// Note: Events can be easily filtered out/deleted once exported from the calendar
//
// Reference Websites:
// https://developers.google.com/apps-script/reference/calendar/calendar
// https://developers.google.com/apps-script/reference/calendar/calendar-event
var mycal = "YOUREMAILORCALENDARADDRESS";
var cal = CalendarApp.getCalendarById(mycal);
//var startDate = Browser.inputBox("Start Date, in format MM / DD / YYYY");
//var endDate = Browser.inputBox("End Date, in format MM / DD / YYYY");
//var startDate = "September 25, 2015 00:00:00 CST";
//var endDate = "September 26, 2015 23:59:59 CST";
// Optional variations on getEvents
// var events = cal.getEvents(new Date("January 3, 2014 00:00:00 CST"), new Date("January 14, 2014 23:59:59 CST"));
// var events = cal.getEvents(new Date("January 3, 2014 00:00:00 CST"), new Date("January 14, 2014 23:59:59 CST"), {search: 'word1'});
//
// Explanation of how the search section works (as it is NOT quite like most things Google) as part of the getEvents function:
// {search: 'word1'} Search for events with word1
// {search: '-word1'} Search for events without word1
// {search: 'word1 word2'} Search for events with word2 ONLY
// {search: 'word1-word2'} Search for events with ????
// {search: 'word1 -word2'} Search for events without word2
// {search: 'word1+word2'} Search for events with word1 AND word2
// {search: 'word1+-word2'} Search for events with word1 AND without word2
//
//var events = cal.getEvents(new Date("September 25, 2015 00:00:00 CST"), new Date("October 01, 2015 23:59:59 CST"), {search: '-project123'});
//var events = cal.getEvents(new Date("September 25, 2015 00:00:00 CST"), new Date("October 02, 2015 23:59:59 CST"));
//var events = cal.getEvents(new Date(startDate), new Date(endDate));
var events = cal.getEvents(new Date("September 29, 2015 00:00:00 CST"), new Date("September 29, 2015 23:59:59 CST"));
var sheet = SpreadsheetApp.getActiveSheet();
// Clear the spreadsheet content before running
sheet.clearContents();
// Create a header record on the current spreadsheet in cells A1:N1 - Match the number of entries in the "header=" to the last parameter
// of the getRange entry below
var header = [["Calendar Address", "Event Title", "Event Description", "Event Location", "Event Start", "Event End", "Calculated Duration", "Visibility", "Date Created", "Last Updated", "MyStatus", "Created By", "All Day Event", "Recurring Event", "ID","Email","Status","Name"]]
var range = sheet.getRange(1,1,1,18);
range.setValues(header);
// Loop through all calendar events found and write them out starting on row 2 (row = 2) to allow for the header on row 1
var row = 2;
for (var i=0;i<events.length;i++)
{
var myformula_placeholder = '';
// Matching the "header=" entry above, this is the detailed row entry "details=", and must match the number of entries of the GetRange entry below
var guestList=events[i].getGuestList(); //GET THE EMAIL AND STATUS OF EACH GUEST FOR EACH EVENT
for(var d=0; guestList!=null && d<guestList.length; d++)
{
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), events[i].getStartTime(), events[i].getEndTime(), myformula_placeholder, ('' + events[i].getVisibility()), events[i].getDateCreated(), events[i].getLastUpdated(), events[i].getMyStatus(), events[i].getCreators(), events[i].isAllDayEvent(), events[i].isRecurringEvent(), events[i].getId(), guestList[d].getEmail(), guestList[d].getGuestStatus(), guestList[d].getName()]];
Logger.log(details);
var range2 = sheet.getRange(row+d,1,1,18);
range2.setValues(details);
var cell=sheet.getRange(row+d,7); // go to column 7 (the placeholder) of the output data
cell.setFormula('=(HOUR(F' +row+ ')+(MINUTE(F' +row+ ')/60))-(HOUR(E' +row+ ')+(MINUTE(E' +row+ ')/60))'); // calculate the number of hours of the session
cell.setNumberFormat('.00');
}
row=row+d; // increment row to start the next output after the previous output
}
}
关于javascript - 从日历问题中检索 guest 列表,Google Apps 脚本 (GAS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32791626/
我想从另一个来ping一个vmware guest虚拟机。两者都是Windows XP并使用NAT。我将VMnet8的IP手动设置为192.168.18.1。 (不使用自动获取IP地址)。另外,我无法
我有一台 Windows 服务器,其 AD 通过 AD 连接同步到 Azure AD,用户正在使用 O365。然后,该租户中的某些帐户会作为 guest 帐户被邀请到另一个租户。 当我从 AD 中删除
我已经在 VPS Debian Linux 机器上安装了最新版本的 RabbitMQ。尝试通过访客/访客登录,但返回消息登录失败。我做了一些研究,发现出于安全原因,禁止通过访客/访客远程登录。 我还尝
情况是我尝试在IE8(Win 7 guest 操作系统)中测试网页,由于某种原因我在js ajax中使用的开发环境中使用了很多“http://localhost:8000” url,所以我无法通过知识
我在 VirtualBox 中使用 Ubuntu 18.04,在安装 guest 添加后,我可以在 virtualbox-guest-dkms 和 virtualbox-guest-dkms-hwe
除了一个问题,我刚刚让运行 CentOS 的 guest 盒完美运行。我正在尝试挂载共享文件夹。我已按照使用此代码获取共享文件夹“可安装”的说明进行操作: VBoxManage sharedfolde
我正在尝试将内容从主机复制到 guest 计算机,但为了复制,我需要安装 guest 附加磁盘。 或者还有其他方法可以访问 guest 计算机上的主机内容,反之亦然? 最佳答案 从 VirtualBo
在为 Web 应用程序用例图建模时,为用户可以拥有的每个角色创建一个角色是否更好?或拥有一个角色、用户和一个具有特权的矩阵? guest < 用户 < 版主 < 管理员 1: guest 、用户、版主
我正在尝试将内容从主机复制到来宾计算机,但要进行复制,我需要安装来宾添加磁盘。。或者,是否有其他方法可以访问来宾计算机上的主机内容,反之亦然?
关于如何解决该错误的任何想法: 在不支持的计算机上尝试了特定于 guest 的操作准备好与客人沟通。这不应该发生并且是一个错误应该报告。 vagrant up 之后? 最佳答案 如果您尝试在 Wind
我正在尝试使用 Virtual Box、Virtual Box Guest Additions 和 Vagrant 运行 Linux VM,并在我的 Windows 7 机器上安装一个文件夹。我已经尝
首先,使用 QEMU Virtual Machine (Debian Sparc64 Etch 4.0) ,我能够成功地从 Guest 到 Host ( ssh ) 获取 scp 和 MacOS Hi
我正在尝试将 KVM guest (Ubuntu 18.04)添加到本地网络,就像网络中的其他真实服务器一样。我在主机系统(Ubuntu 18.04)中配置了 KVM 桥接接口(interface),
当我使用这个命令时: vagrant up 我得到这个错误: [machine1] GuestAdditions versions on your host (4.3.36) and guest (5
我在我的主机上本地运行 MySQL,并且由于原因™我无法在我的 Vagrant 机器内运行它。我知道有一种方法可以通过 iptables 将所有流量转发到 3306 到主机的 IP 地址和端口来解决这
我已经在两台机器A和B之间建立了rabbitMQ联合,双向, 但是有错误 {auth_failure,"ACCESS_REFUSED - 使用身份验证机制 PLAIN 拒绝登录。有关详细信息,请参阅代
我有一个 Web 项目 GUI.. 我最初只与管理员一起工作。 因此,当管理员使用他的用户名和密码登录时,我使用表单例份验证将他重定向到默认页面“Default.aspx”。 但现在我还必须与 gue
我正在开展一个项目,我必须验证适用于英特尔凌动处理器和 Windows 7 操作系统的平台。 我用过: ManagementClass mgmt = new ManagementClass("Win3
我必须处理这个非常可怕的旧 python 项目,它只能在 Windows xp VM 中运行。有没有办法在主机中使用 pycharm 并连接到 guest 中的解释器(顺便说一句,这是 python
我有一个 PHP 项目,本质上是一家公司的订单处理网站。公司中的每个用户都可以访问该网站,并获得应用程序的特定凭据,以控制对页面和功能的访问。 现在我有一个允许访客访问单个页面的请求。这个请求的复杂点
我是一名优秀的程序员,十分优秀!