<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.planetoid.info/index.php?action=history&amp;feed=atom&amp;title=Troubleshooting_of_google_apps_script</id>
	<title>Troubleshooting of google apps script - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.planetoid.info/index.php?action=history&amp;feed=atom&amp;title=Troubleshooting_of_google_apps_script"/>
	<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Troubleshooting_of_google_apps_script&amp;action=history"/>
	<updated>2026-06-05T00:51:15Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.planetoid.info/index.php?title=Troubleshooting_of_google_apps_script&amp;diff=23010&amp;oldid=prev</id>
		<title>Unknown user: Created page with &quot;Troubleshooting of google apps script about CalendarApp  == Fix: TypeError: Cannot read property &#039;createEvent&#039; of null == Code &lt;pre&gt; let cal = CalendarApp.getCalendarById(cale...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Troubleshooting_of_google_apps_script&amp;diff=23010&amp;oldid=prev"/>
		<updated>2022-05-24T14:34:59Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Troubleshooting of google apps script about CalendarApp  == Fix: TypeError: Cannot read property &amp;#039;createEvent&amp;#039; of null == Code &amp;lt;pre&amp;gt; let cal = CalendarApp.getCalendarById(cale...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Troubleshooting of google apps script about CalendarApp&lt;br /&gt;
&lt;br /&gt;
== Fix: TypeError: Cannot read property &amp;#039;createEvent&amp;#039; of null ==&lt;br /&gt;
Code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let cal = CalendarApp.getCalendarById(calendar_id);&lt;br /&gt;
let event = cal.createEvent(title, start_time, end_time);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Error message&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TypeError: Cannot read property &amp;#039;createEvent&amp;#039; of null&lt;br /&gt;
setUpCalendar	@ 程式碼.gs:42&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solution: Verify the {{kbd | key=cal}} variable is not null. &lt;br /&gt;
&lt;br /&gt;
Code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let cal = CalendarApp.getCalendarById(calendar_id);&lt;br /&gt;
Logger.log(&amp;#039;The calendar is named &amp;quot;%s&amp;quot;.&amp;#039;, cal.getName());&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fix: Exception: Action not allowed ==&lt;br /&gt;
Error message&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Exception: Action not allowed&lt;br /&gt;
setUpCalendar	@ 程式碼.gs:45&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let cal = CalendarApp.getCalendarById(calendar_id);&lt;br /&gt;
let event = cal.createEvent(title, start_time, end_time, options);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solution: Verify the gmail account running apps script was allowed to write the google calendar&lt;br /&gt;
&lt;br /&gt;
== Fix: TypeError: cal.createEvent(...).createEventFromDescription is not a function ==&lt;br /&gt;
Error message&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TypeError: cal.createEvent(...).createEventFromDescription is not a function&lt;br /&gt;
setUpCalendar	@ 程式碼.gs:45&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Root cause: use the wrong function&lt;br /&gt;
&lt;br /&gt;
Code&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
let options = {description: description, guests: email_of_guest};&lt;br /&gt;
let event = cal.createEvent(title, start_time, end_time, options);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Further reading ==&lt;br /&gt;
&lt;br /&gt;
* [https://developers.google.com/apps-script/guides/support/troubleshooting Troubleshooting  |  Apps Script  |  Google Developers]&lt;br /&gt;
* [https://developers.google.com/apps-script/reference/calendar/calendar-app?hl=en Class CalendarApp  |  Apps Script  |  Google Developers]&lt;br /&gt;
* [https://ithelp.ithome.com.tw/users/20130625/ironman/4630 一份考卷不夠你可以出兩份！用 google apps script 出線上考題 :: 2021 iThome 鐵人賽]&lt;br /&gt;
&lt;br /&gt;
{{Template:Troubleshooting}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Google]]&lt;/div&gt;</summary>
		<author><name>Unknown user</name></author>
	</entry>
</feed>