Weekly
Archive a website to Drive as Markdown
Each page of a site is saved in Drive as a Markdown file you can read or reuse.
- Runs
- Weekly
- Apps
- Google Drive
- AI
- Not needed
- Access
- write (drive.file)
Send this to your assistant
Create a ClickRuntime automation: every Sunday, read the sitemap of example.com, convert each page to Markdown and save it in my Site archive Drive folder, updating files that already exist.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A researcher tracks a documentation site, a competitor's help center and a policy page that changes quietly. To keep a record she saves pages as PDFs by hand, which break when she needs plain text, or pastes them into Docs, which loses structure. When she wants to give a body of pages to an AI model for analysis, the formatting noise makes the results worse, and there is no old copy to compare with.
Each week, ClickRuntime fetches your sitemap or a list of page addresses, downloads every page and converts the content to Markdown, which keeps headings, lists, links and tables as readable plain text. The Markdown files are uploaded to a Drive folder, and any file that already exists is updated in place instead of duplicated.
Knowledge-base builders, SEO teams and compliance staff use it for archives that stay readable years from now.
What you get out of it
A text archive that stays usable
Markdown opens in any editor, searches quickly and does not depend on a particular tool surviving. A weekly copy of a help center remains readable long after the original site has been redesigned.
Clean input for AI work
Plain headings and paragraphs, without navigation menus and scripts, make a much better source to hand to a language model. Summaries and question answering are more accurate when the text is not buried in markup.
A record of what a page said
When a vendor changes its terms or a competitor edits a pricing page, a dated copy proves what the earlier wording was. That matters in disputes and in simply working out when something changed.
Less manual saving and pasting
Gathering a hundred pages by hand takes a full day and is never repeated. A weekly run keeps the folder current without anyone reopening the site and copying pages one at a time.
Easy to diff and review
Because Markdown is plain text, two versions of a page can be compared line by line with any diff tool. Reviewers see exactly the changed sentences instead of scanning two whole documents.
How it works
What happens, step by step
Once a week ClickRuntime reads your website's list of pages.
It downloads each page and keeps the headings, paragraphs and lists as clean Markdown text.
Each page is saved as a file in your Google Drive archive folder, updating the file if it already exists.
You end up with a readable copy of your whole site in Drive.
Before it runs live
- Connect Google Drive
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Google Drive steps into one automation
Under the hood
The code that runs this automation
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from bs4 import BeautifulSoup
from googleapiclient.http import MediaInMemoryUpload
from clickruntime import on_trigger, credentials, http
SITEMAP, FOLDER = "https://example.com/sitemap.xml", "site-archive-folder-id"
def to_markdown(html):
soup = BeautifulSoup(html, "lxml")
lines = []
for el in soup.select("h1, h2, h3, p, li"):
text = el.get_text(" ", strip=True)
prefix = {"h1": "# ", "h2": "## ", "h3": "### ", "li": "- "}.get(el.name, "")
if text:
lines.append(prefix + text)
return "\n\n".join(lines)
@on_trigger
def run(event):
drive = build("drive", "v3", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
urls = [loc.text for loc in BeautifulSoup(http.get(SITEMAP).text, "xml").find_all("loc")]
existing = {f["name"]: f["id"] for f in drive.files().list(q=f"'{FOLDER}' in parents and trashed = false",
fields="files(id,name)", pageSize=1000).execute()["files"]}
for url in urls:
name = (url.split("://", 1)[1].strip("/").replace("/", "_") or "home") + ".md"
media = MediaInMemoryUpload(to_markdown(http.get(url).text).encode(), "text/markdown")
if name in existing:
drive.files().update(fileId=existing[name], media_body=media).execute()
else:
drive.files().create(body={"name": name, "parents": [FOLDER]}, media_body=media).execute()
return {"pages": len(urls)}FAQ
Common questions
Does it work on pages that need JavaScript to load?
Is it all right to copy a website like this?
How are the Drive files named?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Back up your data to Drive every night
Each night your data is saved to a dated Drive folder, and backups older than 30 days go to trash.
See how it worksKeep your uploads folder sorted
New files get a dated name and move into folders by type, and duplicates are reported to you.
See how it worksCopy new SFTP files into Drive
New files on your FTP or SFTP server are copied into Drive every hour.
See how it worksKeep exploring
Set up “Archive a website to Drive as Markdown” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.