I’m trying to build a tool that exports Google Slides to Figma using Google App Script. My first goal is to move shapes from Slides to Figma. I’m not sure how to start or if it’s even doable.
Here’s what I’m thinking:
- Get Figma shape:
function createFigmaShape() {
const rect = designSpace.addRectangle();
rect.position = { x: 100, y: 100 };
rect.color = { r: 0.8, g: 0.2, b: 0.5 };
return rect;
}
- Get Google Slides shape:
function getSlideShape() {
const presentation = SlidesApp.getActivePresentation();
const slide = presentation.getSlides()[0];
const shape = slide.insertShape(SlidesApp.ShapeType.RECTANGLE);
return shape;
}
- Transfer to Figma:
function moveToFigma(slideShape) {
const figmaShape = createFigmaShape();
figmaShape.width = slideShape.getWidth();
figmaShape.height = slideShape.getHeight();
}
I’m stuck on how to connect Google and Figma. Do I need a Chrome extension or a Slides add-on? Any tips on setting up OAuth between them? Thanks for any help!
hey, i’ve done something similar before. it’s doable but tricky. you’ll need to use figma’s REST API, not the JS one. make HTTP requests from app script. set up OAuth2 for figma access. create a slides add-on for the UI. use UrlFetchApp for API calls. watch out for coordinate differences between slides and figma. good luck!
Having experience with API integrations, I can confirm it’s possible to connect Google App Script with Figma, but it requires some workarounds. The main approach is to use Figma’s REST API instead of their JavaScript API. This means you’ll be making HTTP requests from App Script to Figma’s endpoints.
Authentication is a crucial step. You’ll need to implement OAuth2 to obtain a Figma access token. For the user interface, consider developing a Google Slides add-on. This provides a seamless experience for users within Slides.
A significant challenge you’ll face is reconciling the different coordinate systems between Slides and Figma. You’ll need to implement conversion logic in your script to handle this discrepancy. Also, be mindful of Figma’s API rate limits, especially when dealing with larger exports.
Lastly, use UrlFetchApp in Google Apps Script for making API calls to Figma. This method allows you to send HTTP requests and handle responses effectively.
I’ve tackled similar projects, and while it’s challenging, it’s definitely achievable. The key is using Figma’s REST API instead of their JavaScript API. You’ll need to make HTTP requests from Google Apps Script to Figma’s endpoints.
One thing to keep in mind is that you’ll need to set up OAuth2 authentication to get a Figma access token. This can be a bit tricky, but there are resources available to help with this process.
For the actual implementation, I’d suggest creating a Google Slides add-on. This gives you a nice interface within Slides to work with. You can use UrlFetchApp in Apps Script to make the API calls to Figma.
A major hurdle you’ll face is dealing with the different coordinate systems and units between Slides and Figma. You’ll need to write some conversion logic to handle this.
Also, be aware of Figma’s API rate limits. If you’re working with large presentations, you might need to implement some throttling in your script.
Don’t get discouraged if it takes some time to get everything working smoothly. It’s a complex integration, but the end result can be really powerful. Good luck with your project!
Having implemented similar integrations, I can confirm it’s feasible to connect Google App Script with Figma, albeit with some challenges. The key is utilizing Figma’s REST API instead of their JavaScript API when working within Google App Script. This approach requires making HTTP requests to Figma’s endpoints.
You’ll need to set up OAuth2 authentication to secure an access token for Figma. Creating a Google Slides add-on is advisable, as it provides a user interface within Slides and allows you to trigger your script. Use UrlFetchApp in Google Apps Script to execute API calls to Figma.
A significant hurdle you may encounter is reconciling the different coordinate systems and units between Slides and Figma. This will necessitate implementing conversion logic in your script. Additionally, be mindful of Figma’s API rate limits, especially when handling larger exports.
As someone who’s worked on similar integrations, I can tell you it’s definitely possible to connect Google App Script with Figma, but it’s not straightforward. You’re on the right track with your code snippets, but there are a few key things to consider.
First, you’ll need to use Figma’s REST API, not their JavaScript API, when working with Google App Script. This means making HTTP requests to Figma’s endpoints. You’ll also need to set up OAuth2 authentication to get an access token for Figma.
For the actual integration, I’d recommend creating a Google Slides add-on. This gives you a UI in Slides and lets you trigger your script. You’ll need to use UrlFetchApp in Google Apps Script to make API calls to Figma.
One tricky part is handling the different coordinate systems and units between Slides and Figma. You’ll need to do some conversion there.
Lastly, remember that Figma’s API has rate limits, so you might need to implement some throttling in your script for larger exports. Good luck with your project!