It is possible to call the Domo powerpoint plugin with the API ?
Hi !
I’m looking to run the DOMO powerpoint plugin using a script. Is there a way to do this? An API call to the DOMo plugin?
Basically, the script will need to update the powerpoint based on user-defined filters in a third-party application.
Is that even possible?
Best Answer
-
The PowerPoint plugin is designed to work interactively with PowerPoint so I'm not sure you could do it that way. But you can probably use Python to extract the data from Domo via the Domo API. Then process it according to whatever your needs are such as filtering, aggregating, etc. Then update the PowerPoint with Python.
import requests
#Define your Domo API credentials and dataset ID client_id = 'YOUR_CLIENT_ID'
client_secret = 'YOUR_CLIENT_SECRET'
dataset_id = 'YOUR_DATASET_ID'
#Get access token auth_response = requests.post(
'https://api.domo.com/oauth/token',
data={
'grant_type': 'client_credentials',
'scope': 'data'
},
auth=(client_id, client_secret)
)
auth_data = auth_response.json()
access_token = auth_data['access_token']
#Get data from Domo data_response = requests.get(
f'https://api.domo.com/v1/datasets/{dataset_id}/data',
headers={
'Authorization': f'Bearer {access_token}'
}
)
data = data_response.json()Update PowerPoint would be something like this
from pptx import Presentation
#Create a presentation object prs = Presentation()
#Add a slide with a title and subtitle slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(slide_layout)
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "Title Slide"
subtitle.text = "Subtitle here"
#Add another slide with a title and content slide_layout = prs.slide_layouts[1]
slide = prs.slides.add_slide(slide_layout)
title = slide.shapes.title
title.text = "Content Slide"
#Add data to the slide (e.g., a table) rows = len(data)
cols = len(data[0])
table = slide.shapes.add_table(rows, cols, 0, 0, prs.slide_width, prs.slide_height).table
#Set column names for col_idx, col_name in enumerate(data[0]):
table.cell(0, col_idx).text = col_name
#Fill the table with data for row_idx, row_data in enumerate(data[1:], start=1):
for col_idx, cell_data in enumerate(row_data):
table.cell(row_idx, col_idx).text = str(cell_data)
#Save the presentation prs.save('output_presentation.pptx')** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0
Answers
-
The PowerPoint plugin is designed to work interactively with PowerPoint so I'm not sure you could do it that way. But you can probably use Python to extract the data from Domo via the Domo API. Then process it according to whatever your needs are such as filtering, aggregating, etc. Then update the PowerPoint with Python.
import requests
#Define your Domo API credentials and dataset ID client_id = 'YOUR_CLIENT_ID'
client_secret = 'YOUR_CLIENT_SECRET'
dataset_id = 'YOUR_DATASET_ID'
#Get access token auth_response = requests.post(
'https://api.domo.com/oauth/token',
data={
'grant_type': 'client_credentials',
'scope': 'data'
},
auth=(client_id, client_secret)
)
auth_data = auth_response.json()
access_token = auth_data['access_token']
#Get data from Domo data_response = requests.get(
f'https://api.domo.com/v1/datasets/{dataset_id}/data',
headers={
'Authorization': f'Bearer {access_token}'
}
)
data = data_response.json()Update PowerPoint would be something like this
from pptx import Presentation
#Create a presentation object prs = Presentation()
#Add a slide with a title and subtitle slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(slide_layout)
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "Title Slide"
subtitle.text = "Subtitle here"
#Add another slide with a title and content slide_layout = prs.slide_layouts[1]
slide = prs.slides.add_slide(slide_layout)
title = slide.shapes.title
title.text = "Content Slide"
#Add data to the slide (e.g., a table) rows = len(data)
cols = len(data[0])
table = slide.shapes.add_table(rows, cols, 0, 0, prs.slide_width, prs.slide_height).table
#Set column names for col_idx, col_name in enumerate(data[0]):
table.cell(0, col_idx).text = col_name
#Fill the table with data for row_idx, row_data in enumerate(data[1:], start=1):
for col_idx, cell_data in enumerate(row_data):
table.cell(row_idx, col_idx).text = str(cell_data)
#Save the presentation prs.save('output_presentation.pptx')** Was this post helpful? Click Agree or Like below. **
** Did this solve your problem? Accept it as a solution! **0 -
Agree with @ArborRose on this one. In fact, I had essentially the same response written out, but I guess I forgot to hit "Post". Anyways, just stopping by to say that the path Arbor suggested is the same route I would likely take if I was trying to do this.
David Cunningham
** Was this post helpful? Click Agree 😀, Like 👍️, or Awesome ❤️ below **
** Did this solve your problem? Accept it as a solution! ✔️**0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 298 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 729 Beast Mode
- 54 App Studio
- 40 Variables
- 678 Automate
- 173 Apps
- 451 APIs & Domo Developer
- 46 Workflows
- 8 DomoAI
- 34 Predict
- 14 Jupyter Workspaces
- 20 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 121 Manage
- 118 Governance & Security
- Domo Community Gallery
- 33 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive