<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Convert on tanaike - Google Apps Script, Gemini API, and Developer Tips</title>
    <link>https://tanaikech.github.io/tags/convert/</link>
    <description>Recent content in Convert on tanaike - Google Apps Script, Gemini API, and Developer Tips</description>
    <generator>Hugo</generator>
    <language>ja</language>
    <copyright>&amp;copy; 2026. All rights reserved.</copyright>
    <lastBuildDate>Tue, 23 Jul 2024 11:51:52 +0900</lastBuildDate>
    <atom:link href="https://tanaikech.github.io/tags/convert/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Convert Google Document to Markdown and vice versa using Google Apps Script</title>
      <link>https://tanaikech.github.io/2024/07/23/convert-google-document-to-markdown-and-vice-versa-using-google-apps-script/</link>
      <pubDate>Tue, 23 Jul 2024 11:51:52 +0900</pubDate>
      <guid>https://tanaikech.github.io/2024/07/23/convert-google-document-to-markdown-and-vice-versa-using-google-apps-script/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/0deba74c2003d997f67fb2b04dedb1d0&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://tanaikech.github.io/image-storage/20240723a/fig1.png&#34;&#xA;     alt=&#34;Convert Google Document to Markdown and vice versa using Google Apps Script&#34;&#xA;     &#xA;     loading=&#34;lazy&#34;&#xA;     decoding=&#34;async&#34;&gt;&#xA;&lt;/p&gt;&#xA;&lt;h1 id=&#34;description&#34;&gt;Description&lt;/h1&gt;&#xA;&lt;p&gt;Great news for fans of both Google Docs and Markdown! Google Docs recently acquired the ability to export documents directly into the markdown format. &lt;a href=&#34;https://workspaceupdates.googleblog.com/2024/07/import-and-export-markdown-in-google-docs.html&#34;&gt;Ref&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This functionality extends beyond the user interface, with early indications suggesting the Google Drive API might also be capable of converting between Google Docs and Markdown. I confirmed that this could also be achieved by Drive API. This opens exciting possibilities for automated workflows.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Converting Google Spreadsheet to HTML Table using Google Apps Script</title>
      <link>https://tanaikech.github.io/2023/05/21/converting-google-spreadsheet-to-html-table-using-google-apps-script/</link>
      <pubDate>Sun, 21 May 2023 14:44:47 +0900</pubDate>
      <guid>https://tanaikech.github.io/2023/05/21/converting-google-spreadsheet-to-html-table-using-google-apps-script/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/61932a6acfe02e53ce9d5bca9078c536&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://tanaikech.github.io/image-storage/20230521a/fig1.png&#34;&#xA;     alt=&#34;Converting Google Spreadsheet to HTML Table using Google Apps Script&#34;&#xA;     &#xA;     loading=&#34;lazy&#34;&#xA;     decoding=&#34;async&#34;&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;This is a sample script for converting Google Spreadsheet to an HTML table using Google Apps Script.&lt;/p&gt;&#xA;&lt;p&gt;There is the case that it is required to convert a sheet in a Google Spreadsheet to an HTML table. For example, there might be a situation that a sheet in a Google Spreadsheet is sent as an email including an HTML table. And, there might be a situation in which a sheet in a Google Spreadsheet is published to an HTML page including the converted HTML table. I have published the method for achieving this before. &lt;a href=&#34;https://github.com/tanaikech/RichTextApp&#34;&gt;Ref&lt;/a&gt; But, in that case, the column width, the row height, merged cells, and the images in the cells couldn&amp;rsquo;t be used. When those are included in the script, the script becomes complicated. So, I couldn&amp;rsquo;t include it. But, recently, I have come up with a simple method for achieving this. In this post. I would like to introduce a sample script for converting a sheet in a Google Spreadsheet to HTML.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Simply Converting HTML to Plain Text using Google Apps Script</title>
      <link>https://tanaikech.github.io/2022/04/22/simply-converting-html-to-plain-text-using-google-apps-script/</link>
      <pubDate>Fri, 22 Apr 2022 10:21:48 +0900</pubDate>
      <guid>https://tanaikech.github.io/2022/04/22/simply-converting-html-to-plain-text-using-google-apps-script/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/2779ee59a199011e3f48a1fa92879a68&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a sample script for simply converting HTML to plain text using Google Apps Script.&lt;/p&gt;&#xA;&lt;h2 id=&#34;sample-values&#34;&gt;Sample values&lt;/h2&gt;&#xA;&lt;h3 id=&#34;html-input-value&#34;&gt;HTML (input value)&lt;/h3&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sample1&amp;#34;&lt;/span&gt;&amp;gt;sample text1&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sample2&amp;#34;&lt;/span&gt;&amp;gt;sample text2&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;ul&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sample3&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;li&lt;/span&gt;&amp;gt;sample list 1&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;li&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;li&lt;/span&gt;&amp;gt;sample list 2&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;li&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;ul&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;table&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;sample4&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;tbody&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;tr&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;a1&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;b1&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;c1&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;tr&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;tr&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;a2&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;b2&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;c2&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;td&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;tr&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;tbody&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;table&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;text-output-value&#34;&gt;Text (output value)&lt;/h3&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;sample text1&#xD;&#xA;sample text2&#xD;&#xA;&#xD;&#xA;   - sample list 1&#xD;&#xA;   - sample list 2&#xD;&#xA;&#xD;&#xA;a1 b1 c1&#xD;&#xA;a2 b2 c2&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;sample-script&#34;&gt;Sample script&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;myFunction&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;sampleHTML&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;`&amp;lt;div id=&amp;#34;sample1&amp;#34;&amp;gt;sample text1&amp;lt;/div&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;lt;div id=&amp;#34;sample2&amp;#34;&amp;gt;sample text2&amp;lt;/div&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;lt;ul id=&amp;#34;sample3&amp;#34;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  &amp;lt;li&amp;gt;sample list 1&amp;lt;/li&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  &amp;lt;li&amp;gt;sample list 2&amp;lt;/li&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;lt;/ul&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;lt;table id=&amp;#34;sample4&amp;#34;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  &amp;lt;tbody&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;    &amp;lt;tr&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      &amp;lt;td&amp;gt;a1&amp;lt;/td&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      &amp;lt;td&amp;gt;b1&amp;lt;/td&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      &amp;lt;td&amp;gt;c1&amp;lt;/td&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;    &amp;lt;/tr&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;    &amp;lt;tr&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      &amp;lt;td&amp;gt;a2&amp;lt;/td&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      &amp;lt;td&amp;gt;b2&amp;lt;/td&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      &amp;lt;td&amp;gt;c2&amp;lt;/td&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;    &amp;lt;/tr&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  &amp;lt;/tbody&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;lt;/table&amp;gt;`&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;temp&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;GmailApp&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;createDraft&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;, { &lt;span style=&#34;color:#a6e22e&#34;&gt;htmlBody&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;sampleHTML&lt;/span&gt; });&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;plainText&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;temp&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;getMessage&lt;/span&gt;().&lt;span style=&#34;color:#a6e22e&#34;&gt;getPlainBody&lt;/span&gt;();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;temp&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;deleteDraft&lt;/span&gt;();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;console&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;log&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;plainText&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;This method uses &lt;code&gt;GmailApp.createDraft&lt;/code&gt; for converting HTML to plain text. When a draft email is created with &lt;code&gt;GmailApp.createDraft&lt;/code&gt; by giving an HTML body, when the message content is retrieved with &lt;code&gt;getPlainBody()&lt;/code&gt;, the plain text is retrieved. This method uses this situation.&lt;/li&gt;&#xA;&lt;li&gt;When this sample script is run, the result in &amp;ldquo;Sample values&amp;rdquo; section can be obtained.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;note&#34;&gt;Note&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;This method is a simple conversion from HTML to plain text. So I&amp;rsquo;m not sure whether this method can be used for all HTML data. Please be careful about this.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://developers.google.com/apps-script/reference/gmail/gmail-app#createDraft(String,String,String,Object)&#34;&gt;createDraft(recipient, subject, body, options)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://developers.google.com/apps-script/reference/gmail/gmail-message#getplainbody&#34;&gt;getPlainBody()&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
    </item>
    <item>
      <title>Downloading Active Sheet in Google Spreadsheet as CSV and PDF file by Clicking Button</title>
      <link>https://tanaikech.github.io/2020/11/23/downloading-active-sheet-in-google-spreadsheet-as-csv-and-pdf-file-by-clicking-button/</link>
      <pubDate>Mon, 23 Nov 2020 14:10:37 +0900</pubDate>
      <guid>https://tanaikech.github.io/2020/11/23/downloading-active-sheet-in-google-spreadsheet-as-csv-and-pdf-file-by-clicking-button/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/114dad7d31dde402b4892787e9cceaad&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a sample script for downloading the active sheet in Google Spreadsheet to the local PC as a CSV file and a PDF file when a button on the side bar and the dialog is clicked. This is created with Google Apps Script and HTML&amp;amp;Javascript. In this post, the script of &lt;a href=&#34;https://tanaikech.github.io/2020/11/10/downloading-google-spreadsheet-as-xlsx-and-pdf-file-by-clicking-button/&#34;&gt;the previous post&lt;/a&gt; was modified.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://tanaikech.github.io/img/20201123a-fig1.gif&#34;&#xA;     alt=&#34;Downloading Active Sheet in Google Spreadsheet as CSV and PDF file by Clicking Button&#34;&#xA;     &#xA;     loading=&#34;lazy&#34;&#xA;     decoding=&#34;async&#34;&gt;&#xA;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Converting Texts to Bold, Italic and Bold-Italic Types of Unicode using Google Apps Script</title>
      <link>https://tanaikech.github.io/2020/11/13/converting-texts-to-bold-italic-and-bold-italic-types-of-unicode-using-google-apps-script/</link>
      <pubDate>Fri, 13 Nov 2020 13:39:08 +0900</pubDate>
      <guid>https://tanaikech.github.io/2020/11/13/converting-texts-to-bold-italic-and-bold-italic-types-of-unicode-using-google-apps-script/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/39797ccd1b9280f967fe62b3328d782a&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a sample script for converting the texts to the bold, italic, bold-italic types, underline and strike through of the unicode using Google Apps Script. In the current stage, at Google Docs (Spreadsheet, Document, Slides and so on), the rich texts cannot be directly managed for all places using Google Apps Script. But there are the places which can use the bold, italic and bold-italic fonts with the unicode. This sample script uses this. When this sample script is used, for example, the bold, italic and bold-italic texts can be put using &lt;code&gt;SpreadsheetApp.getUi().alert(convertedText)&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Downloading Google Spreadsheet as XLSX and PDF file by Clicking Button</title>
      <link>https://tanaikech.github.io/2020/11/10/downloading-google-spreadsheet-as-xlsx-and-pdf-file-by-clicking-button/</link>
      <pubDate>Tue, 10 Nov 2020 14:47:43 +0900</pubDate>
      <guid>https://tanaikech.github.io/2020/11/10/downloading-google-spreadsheet-as-xlsx-and-pdf-file-by-clicking-button/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/61dea338dfba386f87c592d4ee6c68af&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a sample script for downloading Google Spreadsheet to the local PC as a XLSX file and a PDF file when a button on the side bar and the dialog is clicked. This is created with Google Apps Script and HTML&amp;amp;Javascript.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://tanaikech.github.io/img/20201110a-img.gif&#34;&#xA;     alt=&#34;Downloading Google Spreadsheet as XLSX and PDF file by Clicking Button&#34;&#xA;     &#xA;     loading=&#34;lazy&#34;&#xA;     decoding=&#34;async&#34;&gt;&#xA;&lt;/p&gt;&#xA;&lt;h2 id=&#34;sample-script&#34;&gt;Sample script&lt;/h2&gt;&#xA;&lt;p&gt;Please create new Google Spreadsheet and copy and paste the following scripts to the script editor. And please run &lt;code&gt;openSidebar()&lt;/code&gt;. By this, the side bar is opened to the Spreadsheet.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Converting SVG Format to PNG Format using Google Apps Script</title>
      <link>https://tanaikech.github.io/2020/07/20/converting-svg-format-to-png-format-using-google-apps-script/</link>
      <pubDate>Mon, 20 Jul 2020 15:23:38 +0900</pubDate>
      <guid>https://tanaikech.github.io/2020/07/20/converting-svg-format-to-png-format-using-google-apps-script/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/8a6d46ca43665aa7e62965ed32336598&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a sample script for converting the SVG image data to PNG image data using Google Apps Script.&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately, in the current stage, there are no methods for directly converting the SVG to PNG in Google Drive service. But it can be achieved by Drive API. The sample script is as follows.&lt;/p&gt;&#xA;&lt;p&gt;Before you use this, &lt;a href=&#34;https://developers.google.com/apps-script/guides/services/advanced#enabling_advanced_services&#34;&gt;please enable Drive API at Advanced Google services&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;sample-script&#34;&gt;Sample script&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;function&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;myFunction&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;svgFileId&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;###&amp;#34;&lt;/span&gt;; &lt;span style=&#34;color:#75715e&#34;&gt;// Please set the fileId of the SVG file.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;url&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Drive&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;Files&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;get&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;svgFileId&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;thumbnailLink&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;replace&lt;/span&gt;(&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;=s220&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;=s1000&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  );&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;blob&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;UrlFetchApp&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;fetch&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;url&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;getBlob&lt;/span&gt;(); &lt;span style=&#34;color:#75715e&#34;&gt;// blob is the image blob of PNG format.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#75715e&#34;&gt;// In this sample, the retrieved image blob is put to Spreadsheet.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;sheet&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;SpreadsheetApp&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;openById&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;###&amp;#34;&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;getSheetByName&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Sheet1&amp;#34;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;sheet&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;insertImage&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;blob&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;setWidth&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;500&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;setHeight&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;500&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;In this sample script, the converted PNG image is put to the Spreadsheet.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Converting Many Files to Google Docs using Google Apps Script</title>
      <link>https://tanaikech.github.io/2019/04/11/converting-many-files-to-google-docs-using-google-apps-script/</link>
      <pubDate>Thu, 11 Apr 2019 11:14:59 +0900</pubDate>
      <guid>https://tanaikech.github.io/2019/04/11/converting-many-files-to-google-docs-using-google-apps-script/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/d60700b523af7aaf89b9e7c92e35c3c2&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a sample script for converting a lot of files to Google Docs (Spreadsheet, Document and Slides).&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://developers.google.com/drive/api/v3/batch&#34;&gt;Batch request&lt;/a&gt; can be used for converting files. In this sample script, the files are converted using the batch request.&lt;/li&gt;&#xA;&lt;li&gt;Batch request can request 100 API by one API call.&lt;/li&gt;&#xA;&lt;li&gt;This sample script uses &lt;a href=&#34;https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app#fetchallrequests&#34;&gt;the fetchAll method&lt;/a&gt;. So even if there are over 100 files, this script can process them.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;sample-script&#34;&gt;Sample script:&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Before you run the script, please set the variables at &lt;code&gt;main()&lt;/code&gt;.&lt;/strong&gt; And, please enable Drive API at Advanced Google services.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Resumable Conversion from CSV File with Large Size (&gt; 50 MB) to Several Spreadsheets by Splitting File</title>
      <link>https://tanaikech.github.io/2018/06/26/resumable-conversion-from-csv-file-with-large-size-50-mb-to-several-spreadsheets-by-splitting-file/</link>
      <pubDate>Tue, 26 Jun 2018 13:00:50 +0900</pubDate>
      <guid>https://tanaikech.github.io/2018/06/26/resumable-conversion-from-csv-file-with-large-size-50-mb-to-several-spreadsheets-by-splitting-file/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/3e44c779f05374d19333444c9a4dd5ba&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;overview&#34;&gt;Overview&lt;/h1&gt;&#xA;&lt;p&gt;This is a sample script which can achieve the resumable conversion from the large CSV-file to several spreadsheets by splitting the CSV file using Google Apps Script (GAS).&lt;/p&gt;&#xA;&lt;h1 id=&#34;description&#34;&gt;Description&lt;/h1&gt;&#xA;&lt;p&gt;Is there a situation that you want to convert a CSV file with the large size (&amp;gt; 50 MB) to Spreadsheet? When such large CSV file is converted to Spreadsheet, you will experience the error. The reason is the size and/or also it may be due to the total cells (&amp;gt; 2,000,000 cells) of CSV file. In this case, you will think that when the file is split, each file can be converted to Spreadsheet. But the blob which can be used at GAS is less than 50 MB (52,428,800 bytes). &lt;strong&gt;&lt;a href=&#34;#References&#34;&gt;Ref1&lt;/a&gt;&lt;/strong&gt; So when you have a CSV file with more than 50 MB, it is not possible to split it. In this case, you can split such large file by files.get of Drive API. files.get of Drive API has a function of Partial download. &lt;strong&gt;&lt;a href=&#34;#References&#34;&gt;Ref2&lt;/a&gt;&lt;/strong&gt; Using this, the file can be split. By the way, in my environment, when a CSV file with the size of 100 MB is used for this sample script, when the file is split by 10 MB, about 65 seconds was required to convert a chunk to Spreadsheet. In this case, when the CSV file is completely converted, it is considered that it will be over the limitation time (6 min) for executing GAS. So in this post, I would like to introduce a sample script which can achieve the resumable conversion from the large CSV-file to several spreadsheets.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Uploading CSV File as Spreadsheet and Modifying Permissions using Golang</title>
      <link>https://tanaikech.github.io/2017/09/21/uploading-csv-file-as-spreadsheet-and-modifying-permissions-using-golang/</link>
      <pubDate>Thu, 21 Sep 2017 15:43:14 +0900</pubDate>
      <guid>https://tanaikech.github.io/2017/09/21/uploading-csv-file-as-spreadsheet-and-modifying-permissions-using-golang/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/7ee103c80759a8297da198a5d1e92fc8&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This sample script is for uploading CSV file as Spreadsheet and modifying permissions using Golang.&lt;/p&gt;&#xA;&lt;p&gt;I think that the detail information of &lt;strong&gt;google-api-go-client&lt;/strong&gt; is a bit little. The sample scripts are so little. It retrieves most information from only &lt;a href=&#34;https://godoc.org/google.golang.org/api/drive/v3&#34;&gt;godoc&lt;/a&gt; and &lt;a href=&#34;https://github.com/google/google-api-go-client/tree/master/drive&#34;&gt;GitHub&lt;/a&gt;. So I publish such sample scripts here. If this is useful for you, I&amp;rsquo;m glad.&lt;/p&gt;&#xA;&lt;h2 id=&#34;important-points-&#34;&gt;Important points :&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Give mimeType of file that it wants to upload to &lt;code&gt;options&lt;/code&gt; of &lt;code&gt;Media(r io.Reader, options ...googleapi.MediaOption)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In order to give &lt;code&gt;options&lt;/code&gt;, use &lt;code&gt;googleapi.ContentType()&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Give mimeType of file that it wants to convert, when it uploads it to Google Drive, to &lt;code&gt;file&lt;/code&gt; of &lt;code&gt;Create(file *File)&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;In order to give &lt;code&gt;file&lt;/code&gt;, use &lt;code&gt;&amp;amp;drive.File{}&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;For installing permissions, use &lt;code&gt;&amp;amp;drive.Permission{}&lt;/code&gt;. Each parameter is the same to them for Python.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;&lt;strong&gt;This sample script uses &lt;a href=&#34;https://developers.google.com/drive/v3/web/quickstart/go&#34;&gt;Quickstart&lt;/a&gt;. So in order to use this sample script, at first, please do Step 1 and Step 2 of the Quickstart.&lt;/strong&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Interconversion Between Google Docs and Microsoft Docs</title>
      <link>https://tanaikech.github.io/2017/08/11/interconversion-between-google-docs-and-microsoft-docs/</link>
      <pubDate>Fri, 11 Aug 2017 15:02:37 +0900</pubDate>
      <guid>https://tanaikech.github.io/2017/08/11/interconversion-between-google-docs-and-microsoft-docs/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://gist.github.com/tanaikech/8d639542577a594f6104b7f6fb753064&#34;&gt;Gists&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Updated: January 22, 2023&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;This sample script is for the interconversion between Google Docs (document, spreadsheet and presentation) and Microsoft Docs (word, excel and powerpoint). The feature is to convert them without &lt;a href=&#34;https://developers.google.com/apps-script/guides/services/advanced&#34;&gt;Advanced Google Services&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Since Advanced Google Services is not used for this, if you publish your script with this script, you are not necessary to explain how to install Advanced Google Services. This script converts between Google Docs and Microsoft Docs using &lt;code&gt;UrlFetchApp.fetch()&lt;/code&gt;. &lt;strong&gt;Although Drive API v3 is used, Drive API is automatically enabled by the recent update on Google.&lt;/strong&gt; &lt;a href=&#34;http://qiita.com/tanaike/items/1d49f73ab05403d0fe4c&#34;&gt;Ref (I&amp;rsquo;m sorry. This is Japanese language.)&lt;/a&gt; So you are not necessary to explain about the use of Drive API. By this, users will be easy to use the scripts that Drive API is used. This is very important for a lot of users.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
