in backend_apis/app/utils_workspace.py [0:0]
def create_sheets_chart(presentation_id: str, page_id: str,spreadsheet_id: str, sheet_chart_id: str):
emu4m = {
'magnitude': 1000000,
'unit': 'EMU'
}
creds, _ = google.auth.default(scopes=config["global"]["workspace_scopes"])
slides_service = build('slides', 'v1', credentials=creds)
presentation_chart_id = 'MyEmbeddedChart'
requests = [
{
'createSheetsChart': {
'objectId': presentation_chart_id,
'spreadsheetId': spreadsheet_id,
'chartId': sheet_chart_id,
'linkingMode': 'LINKED',
'elementProperties': {
'pageObjectId': page_id,
'size': {
'height': emu4m,
'width': emu4m
},
'transform': {
'scaleX': 0.5,
'scaleY': 0.5,
'translateX': 2,
'translateY': 2,
'unit': 'EMU'
}
}
}
}
]
# Execute the request.
body = {
'requests': requests
}
response = slides_service.presentations().batchUpdate(
presentationId=presentation_id, body=body).execute(num_retries=20)
return response