project-demo.mp4
About | Getting Started | Technologies
This project automatically adds whatever images you want to your Google Slides presentation in a customizable way!
- Clone this repo:
git clone https://github.com/erickivel/google-slides-images-filler.git
- Move to the directory:
cd google-slides-images-filler
- Run
npm install
oryarn
to install the dependencies. - Create an account on Imgbb: here and get your API key here, Imgbb is a hosting service that will store the images temporarily (60 seconds) and provide the public image URL that will be useful to add the images in the google slides presentation.
- Create your Google OAuth client credentials (instructions here, in "Authorized redirect URIs" you can put "http://localhost:3333")
- Rename the file
.credentials.example.json
to.credentials.json
, and put theclient_secret
andclient_id
that you get from the last step. - Create a folder on the
src
folder with the name:images
, this is where you'll put your images. - Rename the file
.env.example
to.env
and change the variables:
-IMGBB_API_KEY
: to the API key that you get from step 3.
-PRESENTATION_ID
: you get it from the presentation URL:https://docs.google.com/presentation/d/
PRESENTATION_ID/edit
.
-FIRST_PAGE_OBJECT_ID
: this is the id of the first slide you want to add the images, you can select the desired slide, and get it from the presentation URL: "https://docs.google.com/presentation/d/presentationId/edit#slide=id.
FIRST_PAGE_OBJECT_ID".
-IMAGES_PER_SLIDE
: this is the number of images per slide you want to add, it must be a multiple ofROWS
-ROWS
: this is the number of the row that the images will be divided in each slide
-WIDTH_TO_BE_OCCUPIED
: This is how much all your images will occupy in each slide in centimeters (width)
-COLUMN_GAP
andROW_GAP
: Column and row gaps (in centimeters) - You can also modify some options on the file
addImageToPresentation.js
. - Run
npm run start
oryarn start
to start the project, if it's the first time you're running, you'll need to authenticate: It will appear a link, open it, choose the same google account you used to be the tester of your API (step 5), then you'll be redirected tohttp://localhost:3333/?code=
CODE&scope=...
copy the code and paste it in the terminal. After that, a file namedtoken.json
will be added to the root of the project so that you don't need to repeat this authentication process, and the images will be added to your presentation!
Notes:
- If the code starts with
4/
you'll need to remove thedecodeURIComponent()
function, but maintain thecode
param, from the line 58 in the fileindex.js
; - If
No refresh token is set
error happens jut delete thetoken.json
and run the code again (it'll asks you to authenticate again);
These are the technologies that I used to develop this application:
⚙️ NodeJS —> A platform for building network applications;
🌐 Axios —> Used to do HTTP requests;
🔧 Dotenv —> Load environmental variables;
📊 Googleapis —> Used to access google slides api methods;
🖼️ form-data —> Used to upload images;