Google Slides Replacer
No credit card required
Google Slides Replacer
No credit card required
Automate the creation of Google Slides presentations from a template, with support for dynamic text replacement.
Google Slides Replacer Actor
What does the Google Slides Replacer Actor do?
The Google Slides Replacer Actor automates the process of creating a copy of a Google Slides presentation and replacing specified text within it. This Actor utilizes the Google Drive and Google Slides APIs to perform its tasks.
The Actor's workflow is as follows:
- Authentication: Authenticates with Google using either service account or user authentication methods.
- Template Copying: Creates a copy of a specified Google Slides template.
- Text Replacement: Replaces specified text in the new presentation based on provided key-value pairs.
- Output: Outputs the ID of the newly created presentation.
Usage instructions
-
Set up Google API credentials:
- Follow the instructions to obtain Google API credentials for either service account or user authentication.
- Ensure the necessary APIs (Google Drive API and Google Slides API) are enabled in your Google Cloud project.
-
Provide input parameters:
- Fill in the required input parameters in the Apify Actor configuration.
-
Run the Actor:
- Execute the Actor. It will create a new presentation, make the specified text replacements, and output the new presentation's ID.
Input parameters
The Actor accepts the following input parameters:
Parameter | Type | Description | Required |
---|---|---|---|
authType | String | The type of authentication to use. Must be either "service_account" or "user". Default to "user". | No |
authToken | String | A JSON string containing the authentication token information. | Yes |
templateId | String | The ID of the Google Slides template to copy. | Yes |
newFileName | String | The name to give to the new copy of the presentation. | Yes |
replacements | String | A JSON string containing key-value pairs of text to replace in the presentation. | Yes |
Obtaining the Google auth token
Follow the official Google documentation about authentication and authorization.
- Ensure that the provided authentication credentials have the necessary permissions to access and modify Google Drive and Google Slides.
- When using service account authentication, make sure to share the template presentation with the service account email address.
Service account authentication
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Enable the Google Drive API and Google Slides API for your project.
- Go to "APIs & Services" > "Credentials".
- Click "Create Credentials" and select "Service Account".
- Fill in the required information and create the service account.
- Once created, go to the service account details and add a new key (JSON type).
- Download the JSON key file.
- Set the
authType
input to "service_account". - Use the contents of this JSON file as the
authToken
input for the Actor.
Official Google documentation about service account authentication.
User authentication
-
Go to the Google Cloud Console.
-
Create a new project or select an existing one.
-
Enable the Google Drive API and Google Slides API for your project.
-
Go to "APIs & Services" > "Credentials".
-
Click "Create Credentials" and select "OAuth client ID".
-
Choose "Desktop app" as the application type.
-
Download the client configuration file.
-
Use the
gcloud
CLI to obtain the refresh token:gcloud auth application-default login
-
Create a JSON object with the client ID, client secret, and refresh token:
1{ 2 "client_id": "YOUR_CLIENT_ID", 3 "client_secret": "YOUR_CLIENT_SECRET", 4 "refresh_token": "YOUR_REFRESH_TOKEN" 5}
-
Set the
authType
input to "user". -
Use this JSON object as the
authToken
input for the Actor.
Official Google documentation about user authentication.
Finding the template ID
To find the template ID of a Google Slides presentation:
-
Open the Google Slides presentation in your web browser.
-
Look at the URL in the address bar. It will look something like this:
https://docs.google.com/presentation/d/1A2B3C4D5E6F7G8H9I0J/edit
-
The template ID is the long string of characters between
/d/
and/edit
. In this example, the template ID is1A2B3C4D5E6F7G8H9I0J
.
Results
The Actor outputs the ID of the newly created presentation to the default key-value store with the key OUTPUT
. Example:
1{ 2 "OUTPUT": "1A2B3C4D5E6F7G8H9I0J" 3}
Error handling
The Actor includes error handling for:
- Authentication failures
- File copying issues
- Text replacement problems
Any errors encountered during execution are logged for troubleshooting.
Actor Metrics
1 monthly user
-
0 No stars yet
>99% runs succeeded
Created in Jul 2024
Modified 2 months ago