<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Crypto-#Cam on Medium]]></title>
        <description><![CDATA[Stories by Crypto-#Cam on Medium]]></description>
        <link>https://medium.com/@Cammycrypto?source=rss-4978514e7f04------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CWOyYpRpfzdVteDohiQmzQ.jpeg</url>
            <title>Stories by Crypto-#Cam on Medium</title>
            <link>https://medium.com/@Cammycrypto?source=rss-4978514e7f04------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 01:00:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Cammycrypto/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ Automating Google Docs Cleanup with Apps Script: My Beginner’s Journey]]></title>
            <link>https://medium.com/@Cammycrypto/automating-google-docs-cleanup-with-apps-script-my-beginners-journey-af813e81441e?source=rss-4978514e7f04------2</link>
            <guid isPermaLink="false">https://medium.com/p/af813e81441e</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Crypto-#Cam]]></dc:creator>
            <pubDate>Sun, 13 Jul 2025 14:11:52 GMT</pubDate>
            <atom:updated>2025-07-13T14:11:52.662Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZpK3Sm0Q48RXITPClz_ZeQ.png" /></figure><h3>Introduction</h3><p>A month ago, I started learning HTML. Today, I built a fully automated script that cleans up dynamic content in Google Docs using Google Apps Script and JavaScript — with zero previous scripting experience. Here’s how I did it, what I learned, and how you can do it too.</p><h3>🧠 The Challenge</h3><p>Every day, my team updates a Google Doc with new information.<br> Some sections — like <strong>“Andere cases” </strong>(Other cases) — fill up with temporary or ever-changing data.<br> I wanted a way to automatically delete everything between two consistent section headers (“Andere cases” and “Positieve interacties:” positive interactions) without worrying about line numbers or content, since the content between them changes daily.</p><p><strong>Requirements:</strong></p><ul><li>Keep anything before “Andere cases”</li><li>Delete everything between “Andere cases” and “Positieve interacties:”</li><li>Keep anything after “Positieve interacties:”</li><li>The script must work no matter how many lines, paragraphs, or topics are added daily</li></ul><h3>🛠️ The Exploration &amp; Problem Solving</h3><p>At first, I tried to:</p><ul><li>Use line numbers and paragraph indices (but content moved, so this always broke)</li><li>Insert custom markers like &lt;!-- START DELETE --&gt;, but it was clunky and not always clear to collaborators</li></ul><p><strong>With help, I learned:</strong></p><ul><li>Every paragraph/element in Google Docs can be referenced by index, <em>but</em> indices break if the document changes shape</li><li>Section headings that <em>never change</em> are the best “anchors” for automation</li><li>Google Apps Script can access and edit Google Docs by searching for exact text, such as section headers.</li></ul><h3>🧑‍💻 The Solution</h3><p>I wrote a Google Apps Script that:</p><ol><li>Searches the document for a start header (“Andere cases:”)</li><li>Searches for the next end header (“Positieve interacties:”)</li><li>Deletes all paragraphs in between, no matter what they contain</li></ol><blockquote><strong><em>Why this works:</em></strong><em><br> It’s robust against document changes, as long as the section titles are stable.</em></blockquote><p>🔍 The Final Code</p><pre>function deleteBetweenSectionHeaders() {<br>  const docId = &#39;YOUR_DOCUMENT_ID_HERE&#39;; // Replace with your Google Doc ID<br>  const doc = DocumentApp.openById(docId);<br>  const body = doc.getBody();<br><br>  const startHeader = &#39;Andere cases:&#39;; // Section where deletion starts<br>  const endHeader = &#39;Positieve interacties:&#39;; // Section where deletion ends<br><br>  const total = body.getNumChildren();<br>  let startIndex = -1;<br>  let endIndex = -1;<br><br>  // Find the indices of the start and end headers<br>  for (let i = 0; i &lt; total; i++) {<br>    const element = body.getChild(i);<br>    if (element.getType() === DocumentApp.ElementType.PARAGRAPH) {<br>      const text = element.asParagraph().getText().trim();<br>      if (text === startHeader &amp;&amp; startIndex === -1) {<br>        startIndex = i;<br>      } else if (text === endHeader &amp;&amp; startIndex !== -1) {<br>        endIndex = i;<br>        break;<br>      }<br>    }<br>  }<br><br>  // Delete everything between the two section headers (exclusive)<br>  if (startIndex !== -1 &amp;&amp; endIndex !== -1 &amp;&amp; endIndex &gt; startIndex) {<br>    for (let i = endIndex - 1; i &gt; startIndex; i--) {<br>      body.removeChild(body.getChild(i));<br>    }<br>    Logger.log(`Deleted everything between &quot;${startHeader}&quot; and &quot;${endHeader}&quot;.`);<br>  } else {<br>    Logger.log(&quot;Could not find both headers or headers in the wrong order.&quot;);<br>  }<br>}</pre><h3>🏁 What I Learned</h3><ul><li><strong>How Google Apps Script works:</strong> It’s JavaScript for Google Workspace, runs in the cloud, and can automate Docs, Sheets, and more</li><li><strong>How to manipulate documents dynamically:</strong> By searching for section headers, not relying on line numbers</li><li><strong>How to think like a developer:</strong> Breaking problems down, troubleshooting, and iterating toward a robust, reusable solution</li><li><strong>The value of automation:</strong> This script saves time, avoids manual errors, and can be run on-demand or scheduled daily.</li></ul><h3>🚩 How to Use This Code</h3><ol><li>Go to <a href="https://script.google.com/">script.google.com</a> and create a new Apps Script project attached to your Google Doc</li><li>Replace YOUR_DOCUMENT_ID_HERE in the script with your actual Google Doc ID</li><li>Save and run the function — your doc will be automatically cleaned!</li><li>Optional: Add a menu button for one-click operation, or set a time-based trigger for automation.</li></ol><h3>📚 Final Thoughts</h3><p>Even as a beginner, you can automate real-world workflows and impress your team.<br> If you can learn HTML, you can learn Apps Script and JavaScript — one real problem at a time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af813e81441e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>