Knowledge Drop

Can I download a dashboard as a CSV or PDF via the API?

  • 15 June 2021
  • 4 replies
  • 1921 views

Userlevel 5

Last tested: Sep 27, 2019
 

For PDF: Yes. Use create_render_task() to schedule a job to render a dashboard (or other content) as a PDF file.
Use render_task(id) to check the status of the render task. When it completes, use render_task_results() to fetch the PDF file.

Note that PDF files are binary data, not JSON text. Client apps calling the render_task_results() may need to take special steps to fetch the HTTP response body as binary data, not as json text.

For CSV of dashboard data: Yes, with some work. We don't offer an API to run all queries for a dashboard and return all the results. What you can do is fetch the dashboard, iterate through its tiles and find all the queries it refers to, and run those queries via the API, in CSV format. Don't forget to apply filters!

If you are familiar with the SDKs, there are some examples there as well:

Python: https://github.com/looker-open-source/sdk-codegen/blob/master/examples/python/download_dashboard_pdf.py

Ruby: https://github.com/looker-open-source/sdk-codegen/blob/master/examples/ruby/download_dashboard.rb

Typescript: https://github.com/looker-open-source/sdk-codegen/blob/master/examples/typescript/downloadDashboard.ts

 

This content is subject to limited support.                

 

 


4 replies

@Department of Customer Love Hello! Could you please share the python script how to download data in csv format from dashboard as well on git? I’m quite new in Python and would be appreciate for your help! Thanks

Vladmir,

 

Have a example here 

 

https://help.looker.com/hc/en-us/articles/360023624154-Using-the-Looker-API-to-Generate-PDFs

@danieldiniz hello! 

 

I went to that Looker Helpcenter example but the "import looker" doesn't work. Do you know if now the only option is to use "import looker_sdk" as shown in the GitHub example?

Thanks in advance.

 

@Department of Customer Love / @danieldiniz - Is there a way where only CSV can be downloaded of a looker dashboard? Can you please provide some help links or code examples for the same?
 

Reply