Google Workspace integration
Google Slides, Drawings, Docs, and Sheets are convenient places to make a poster, a diagram, or a document with collaborators, since they work in the browser with nothing to install. The catch is the same as with any file made outside the project: figures have to be copied in by hand each time they change, and exports, e.g., a PDF or a PNG, easily fall out of step with the file they came from.
With Calkit, a Google Workspace file is part of the project. The pipeline exports it, e.g., a drawing to a PNG or a sheet to a CSV, and the export goes out of date when the file is edited in Google, just as it would when a script changes. A Google Slides presentation can also show the project's latest figures, values, and tables, and its slides can be exported as figures.
Connecting your Google account
Calkit reaches Google through your Calkit account, so connect Google there once: in your Calkit account settings, under Connected accounts, click Connect next to Google.
If you run a command that needs Google before connecting it, Calkit opens that page for you and carries on once it's connected.
Calkit can only see the files it creates, or ones you select for it in Google's file picker, not the rest of your Google Drive.
Google asks which of your accounts to connect. A work or school account's administrator may not allow apps like Calkit, in which case Google says so; connect a personal account instead. Only one Google account can be connected at a time.
Creating a presentation
On the hub, open the project's Presentations page, click +, and choose New Google Slides presentation. Give it a title, whether it's slides or a poster, and where the exported PDF should go in the project. Calkit creates the presentation in your Google Drive, adds it to the project, and gives you a link to open it in Google Slides.
From the command line, the same thing is:
calkit new google-slides --title "My poster" --kind poster \
--path poster/poster.pdf --figure figures/rates.png
To add a presentation you already have, use its URL:
calkit import google-slides https://docs.google.com/presentation/d/... \
-o talk/talk.pdf -o talk/talk.pptx
Adding a drawing, document, or spreadsheet
Any Google Slides, Drawings, Docs, or Sheets file can be exported to the project by its URL, to one or more files whose extensions say the format:
calkit import google-drawings https://docs.google.com/drawings/d/... \
-o figures/overview.png -o figures/overview.pdf
- A drawing can be exported to PNG, JPEG, SVG, or PDF, and is added to the project's figures.
- A document can be exported to PDF, Word (
.docx), Markdown, or text. - A spreadsheet can be exported to Excel (
.xlsx), PDF, CSV, or TSV. A CSV or TSV holds the first sheet. - A presentation can be exported to PDF or PowerPoint (
.pptx), and its PDFs are added to the project's presentations.
If Calkit can't open the file yet, e.g., because you made it in Google Drive, Calkit opens Google's file picker with it selected, so you can let Calkit open it, and carries on once you have. You can also select files there yourself, from Connected accounts in your Calkit account settings.
Showing one in a Markdown file
An image in a Markdown file can come straight from a Google file, with no stage to write, by naming the file's URL in a comment above it:
<!-- calkit google-drawings-export https://docs.google.com/drawings/d/.../edit -->

The file needs a markdown stage, which Calkit uses to add the export.
See Runnable Markdown.
Showing one in LaTeX, Quarto, or MyST
A figure in LaTeX, Quarto, or MyST can say which Google file it's
exported from, with an option naming the file's app:
google-slides, google-drawings, google-docs, or google-sheets.
In LaTeX:
\ckfigure[width=0.5\linewidth,google-drawings={https://docs.google.com/drawings/d/.../edit}]{figures/setup.png}
In Quarto:
::: {.ckfigure src="figures/setup.png" google-drawings="https://docs.google.com/drawings/d/.../edit"}
Setup
:::
In MyST:
```{ckfigure} figures/setup.png
:google-drawings: https://docs.google.com/drawings/d/.../edit
Setup
```
Calkit adds a stage that exports the file to the figure,
named for the document's stage and the figure, e.g., paper/setup,
which goes out of date when the file is edited in Google,
so the document is built after it.
The figure's path is relative to the project, as for any ckfigure,
and its extension says the format.
Figures from the same Google file are exported by one stage,
named for the first; give it stage-name to call it something else,
e.g., if two files' figures have the same name.
A figure several documents show is exported once,
by a stage named for the first of them,
which is frozen only if they all are.
In Quarto, a figure in a file the document includes isn't found;
put it in the document itself.
For one slide of a presentation, use its URL open at that slide,
or give the slide's ID with slide, e.g.,
google-slides=https://docs.google.com/presentation/d/.../edit,slide=g2c3a1b9_0_12.
In LaTeX, write a # in a URL as \# and a % as \%.
A bare # only works outside another command's argument,
so not, e.g., in \fbox or a Beamer frame.
These options are \ckfigure's alone; \includegraphics doesn't take them.
What's added to the project
The file itself stays in Google Drive.
The project gets a pipeline stage that exports it,
and for a presentation, the presentation,
in calkit.yaml:
presentations:
- path: poster/poster.pdf
title: My poster
kind: poster
pipeline:
stages:
export-poster:
kind: google-slides-export
url: https://docs.google.com/presentation/d/.../edit
inputs:
- figures/rates.png
outputs:
- poster/poster.pdf
- poster/poster.pptx
poster/poster.pdfis the exported presentation.poster/poster.pptxis a PowerPoint copy, so the project keeps an editable version even without Google. Leave it out with--no-pptx..calkit/google/records when each file was last edited, which is how Calkit knows an export is out of date. It's committed with the project.
Putting project figures in a presentation
Each PNG, JPEG, or GIF figure in the stage's inputs is put into the
presentation before it's exported.
Add one with --figure when creating or importing the presentation,
or by adding it to inputs in calkit.yaml.
The first time, a figure is added to the first slide,
so move and resize it where it belongs.
After that, each run replaces it in place with the latest version,
keeping its position and size.
Calkit finds it by its alt text title, calkit: followed by the figure's
path, e.g., calkit:figures/rates.png,
so a figure can be shown in more than one place by copying it.
If no image has that title, e.g., because it was deleted,
the next run adds the figure to the first slide again.
Showing results and tables
A text box or a table in a presentation can show a value or a table from
the project, filled in each time the pipeline runs,
like \ckvalue and \cktable in LaTeX.
- For a value, add a text box, then set its alt text title
(right-click, Alt text, Advanced options, Title)
to
calkit:, the results file,#, and the key, optionally followed by:and a format, e.g.,calkit:results/wake.json#mean_deficit:.2f. Results files can be JSON, YAML, or TOML, and keys reach into nested values with dots, e.g.,case.score. Formats are Python format specs, e.g.,.2ffor two decimal places. - For a table, add a table, then set its alt text title to
calkit:and a CSV or TSV file, e.g.,calkit:results/cases.csv. Its cells are filled with the file's, header first, and rows and columns are added or removed to fit.
Each run replaces the text and keeps its style,
e.g., a value's font and size, or a table's colors,
and leaves alone what's already up to date.
Add the files to the stage's inputs,
so the presentation goes out of date when they change:
pipeline:
stages:
export-poster:
kind: google-slides-export
url: https://docs.google.com/presentation/d/.../edit
inputs:
- results/wake.json
- results/cases.csv
outputs:
- poster/poster.pdf
On the hub, a presentation lists the figures, values, and tables it shows.
Making figures in Google Slides
A slide can also be a figure,
e.g., a diagram or a composite figure drawn in Google Slides,
exported to the project like any other, e.g., for a paper on Overleaf.
Open the slide in Google Slides, copy its URL,
which ends with #slide=id. and the slide's ID, and run:
calkit new figure figures/setup.pdf --title "Setup" \
--google-slide "https://docs.google.com/presentation/d/.../edit#slide=id.g2c3a1b9_0_12"
The stage that exports the presentation, or a new one if there isn't one, then exports the slide too:
pipeline:
stages:
export-diagrams:
kind: google-slides-export
url: https://docs.google.com/presentation/d/.../edit
outputs:
- path: figures/setup.pdf
slide: g2c3a1b9_0_12
- The figure is cropped to what's drawn on the slide, plus a small margin.
- It can be a PDF, or a PNG at 300 DPI.
- The slide's speaker notes say which figure it is, e.g.,
calkit:figures/setup.pdf, so whoever edits the presentation can tell. - Slides can be reordered, since they're found by ID. If the slide is deleted, the export says so, and names a slide whose notes still say which figure it is, e.g., a copy.
- A skipped slide can't be exported, since Google leaves it out of exports.
Keeping the export up to date
Run the pipeline as usual:
which checks Google for edits first, then exports each file that changed, putting figures, values, and tables into presentations first.
calkit status and calkit pull also check whether files were edited,
so they show as out of date.
calkit status checks each file at most every five minutes.
To only check Google, run:
If you're offline, calkit status warns that it couldn't check,
and shows everything else as usual.
Working with collaborators
A file belongs to whoever created it in Google Drive, but everyone with access to the project can use it.
- Each collaborator is given edit access to the file in Google Drive, or view access if they can only read the project, when it's added to the project and when they join the project, so they can open it in Google. It's shared with the email of the Google account they signed in to Calkit with, or otherwise their Calkit email, once it's verified.
- Removing someone from the project, or deleting the project, takes that access back, unless another of their projects uses the file. Access they had before is left alone.
- Running the pipeline goes through the Google account of whoever added the file to the project, so collaborators can export it, and put figures in a presentation, without connecting their own Google account. If that person disconnects Google from Calkit, the project can't reach the file until they connect it again. If they leave the project, the access given through their account is taken back, and someone else can add the file again with theirs.
Making a project public
Making a project public doesn't change who can see its files in Google; anyone can see their exports in the project. To also let anyone with a file's link view it, check Also let anyone with the link view its Google files when making the project public. That includes a presentation's speaker notes and skipped slides, which aren't in the exported PDF. Making the project private again stops that, unless anyone with the link could view it before.