I need to exports data of dashboard or analysis by API it’s possible?
Hello Fabricio,
Yes, it is possible to export data from Amazon Quick Sight dashboards and analyses using the Quick Sight API. Amazon Quick Sight provides a set of APIs that allow you to programmatically interact with Quick Sight resources, including dashboards, analyses, and data sources.
To export data from Quick Sight dashboards or analyses using the API, you can follow these general steps:
- Set up AWS credentials: You need to have valid AWS credentials (access key and secret key) with permissions to access the Quick Sight service and the specific resources you want to export data from.
- Install the AWS SDK: Install the AWS SDK for the programming language of your choice (e.g., Python, Java, Node.js, .NET). The SDK provides convenient methods for interacting with AWS services, including Quick Sight.
- Use the Quick Sight API to export data: The Quick Sight API provides several operations that allow you to export data from dashboards and analyses. Here are some relevant operations:
GetDashboardEmbedUrl: Generates an embed URL that you can use to embed the entire dashboard in a web page. You can then parse the data from the embedded dashboard.GetSessionEmbedUrl: Generates an embed URL for a Quick Sight session. This allows you to embed specific analyses or visualizations within a dashboard.ExportData: Exports data from a Quick Sight dataset or analysis in various formats, including CSV, Excel, and JSON.
- Handle the API response: Depending on the API operation you use, you will receive a response containing the exported data or an embed URL. You can then process the data or embed the dashboard/analysis in your application as needed.
Here’s an example of how you can use the Python AWS SDK (Boto3) to export data from a Quick Sight analysis:
import boto3
# Set up Quick Sight client
quicksight = boto3.client('quicksight')
# Export data from an analysis
response = quicksight.export_data(
AwsAccountId='YOUR_AWS_ACCOUNT_ID',
DataSource={
'Arn': 'ARN_OF_YOUR_ANALYSIS'
},
ExportDataRequestOptions={
'ExportDataFormat': 'CSV'
}
)
# Process the exported data
exported_data = response['ExportDataResponse']['Body'].read()
Note that you need to replace 'YOUR_AWS_ACCOUNT_ID' and 'ARN_OF_YOUR_ANALYSIS' with your actual AWS account ID and the Amazon Resource Name (ARN) of the analysis you want to export data from.
Additionally, make sure to review the Quick Sight API documentation and pricing details, as some API operations may incur charges based on your usage.
Thanks man but i tried and got this error:
AttributeError: ‘Quick Sight’ object has no attribute ‘export_data’
Hi @murili - Thanks for the details. Is it possible to share the documentation link for export data api for quicksight. This is really an important feature and we all are waiting for a long time. please share.
Regards,
Sanjeeb
Hi @Fabricio,
It’s been awhile since we last heard from you, did you have any additional questions or were you able to find a work around for your case?
If we do not hear back within the next 3 business days, I’ll go ahead and close out this topic.
Thank you!
Hi @Fabricio,
Since we haven’t heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion if it contains relevant information that may be needed.
Thank you!