Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/688406d1-62a4-8012-949f-ac50d0247df3
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Assistant: 1 Where to locate & edit the constants === ===== 1 Where to locate & edit the constants ===== # Open the bound Apps Script project - In your Google Sheet choose Extensions → Apps Script (this opens the online code editor at script.google.com). # Find the constant block - In the default Code.gs file you’ll see a comment header /** ========= CONFIG ========= */ Immediately below it are the five constants you must change: ``<code>javascript const PUBLISHED_URL = '<PUBLISHED_SHEET_WIDGET_URL>'; const FOLDER_ID = '<TARGET_DRIVE_FOLDER_ID>'; const PNG_NAME = 'sheet_widget.png'; const PROP_KEY = 'PNG_FILE_ID'; const SCREENSHOT_API = 'https://image.thum.io/get/'; const SCREENSHOT_API_KEY = '<YOUR_SCREENSHOT_SERVICE_KEY>'; </code>`<code> # What to paste into each placeholder | Constant | Where to get the value | | ------------------ | ------------------------------------------------------------------------------------------------------------------------ | | PUBLISHED_URL | In the Sheet: File → Share → Publish to web. Choose the specific tab and click Publish. Copy the URL that appears and paste it (keep the single quotes). | | FOLDER_ID | Create or pick a Drive folder → open it → copy the long ID from the URL (the string after folders/). Example: https://drive.google.com/drive/folders/'''1A2B3C...''' | | PNG_NAME | Leave as‑is unless you want a different filename. | | PROP_KEY | Leave as‑is (it’s just an internal reference). | | SCREENSHOT_API | Leave default for Thum.io, or replace with ScreenshotAPI’s base endpoint if you use that service. | | SCREENSHOT_API_KEY | Paste your Thum.io or ScreenshotAPI key (between quotes) or leave blank if the service doesn’t require authentication. | ===== 2 How to run the script the first time ===== # In the Apps Script editor, click the function‑picker drop‑down (upper‑left, just to the right of the debug bug icon) and select </code>snapshotSheetToPng`. # Press the ► Run button. # A permissions dialog appears: - Click Review permissions, choose your Google account, then Allow the requested scopes (Drive write, external requests). # Watch the Execution log (View → Logs). You should see Updated PNG → https://drive.google.com/file/d/…/view. # Open the target Drive folder—sheet_widget.png should be there. Right‑click → Get link and confirm the sharing setting is Anyone with the link → Viewer (that makes the image accessible to Cozyla). ===== 3 How to deploy the script on an automatic trigger ===== # In the Apps Script toolbar click the ⏰ Triggers icon (left sidebar) or choose Triggers from the left navigation panel (it looks like a clock). # Click + Add Trigger (lower‑right). # Fill out the dialog: - Choose which function to run: snapshotSheetToPng - Choose which deployment should run: Head (default) - Select event source: Time‑driven - Select type of time‑based trigger: For most dashboards: Hour timer or Minute timer (e.g., “Every 15 minutes” keeps the widget fresh without burning free‑tier limits.) - Click Save. # Accept the authorization prompt if it reappears—Apps Script needs separate consent for triggers. # The trigger now shows in the list with the next scheduled run time. From here you can: - Edit frequency by clicking the pencil icon. - Monitor executions under Executions in the left sidebar. - Delete/disable if you hit service rate limits. ===== Quick test that everything works ===== * Wait for the first scheduled trigger or manually press ► Run again. * Refresh Cozyla; the Web Image widget should now show the latest screenshot. * Check Drive file Version history (Right‑click → Manage versions) to confirm the PNG is updating instead of creating duplicates. That’s it—constants edited, script authorized, trigger deployed, and your Cozyla dashboard stays in sync automatically.
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)