{"id":234,"date":"2020-07-11T11:30:00","date_gmt":"2020-07-11T11:30:00","guid":{"rendered":"https:\/\/zettaflow.tech\/blog\/?p=234"},"modified":"2025-07-13T19:52:27","modified_gmt":"2025-07-13T19:52:27","slug":"how-to-link-your-sql-queries-to-excel-or-google-sheets","status":"publish","type":"post","link":"https:\/\/tapegraph.io\/blog\/how-to-link-your-sql-queries-to-excel-or-google-sheets\/","title":{"rendered":"How to Link Your SQL Queries to Excel or Google Sheets"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"572\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/SQL-to-Excel-or-Sheets-or-CSV-1024x572.jpg\" alt=\"How to Link Your SQL Queries to Excel or Google Sheets\" class=\"wp-image-235\" style=\"width:529px;height:295px\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/SQL-to-Excel-or-Sheets-or-CSV-1024x572.jpg 1024w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/SQL-to-Excel-or-Sheets-or-CSV-300x168.jpg 300w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/SQL-to-Excel-or-Sheets-or-CSV-768x429.jpg 768w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/SQL-to-Excel-or-Sheets-or-CSV.jpg 1042w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<!--more-->\n\n\n\n<p>Have you ever come up with such an idea?<\/p>\n\n\n\n<p>Why would you do that?<\/p>\n\n\n\n<p>The possibilities of spreadsheets are huge. There are plenty of ways to use them. And definitely using spreadsheets you can process and visualize data.<\/p>\n\n\n\n<p>Spreadsheets serve as one of the main tools for the majority of companies in the world.&nbsp;<\/p>\n\n\n\n<p>Spreadsheets have the best user interface ever created. People are just getting it kind of naturally.&nbsp;<\/p>\n\n\n\n<p>It is easy to learn, easy to use, easy to implement, and easy to integrate.&nbsp;<\/p>\n\n\n\n<p>It is proved, in particular,&nbsp; by Excel, one of the most successful software in history. According to Microsoft, Excel is used by every fifth adult person on earth.<\/p>\n\n\n\n<p>Interestingly, there are currently many startups that consider spreadsheets to be their main competitor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"let-s-start\">Let\u2019s start<\/h2>\n\n\n\n<p>We can do it using <a href=\"https:\/\/tapegraph.io\/\" target=\"_blank\" rel=\"noopener\" title=\"\">tapegraph.io<\/a>.<\/p>\n\n\n\n<p>First, we have to connect to the database. For our example, we may use the <a href=\"https:\/\/clickhouse.com\/docs\/en\/getting-started\/example-datasets\/ontime\/\" target=\"_blank\" rel=\"noreferrer noopener\">Airline On-Time Performance Database<\/a>.&nbsp;<\/p>\n\n\n\n<p>Then we need to create a new SQL query (let\u2019s name it the <strong>Chicago flights<\/strong>):<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"429\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-New-SQL-query.png\" alt=\"Zettaflow New SQL Query\" class=\"wp-image-237\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-New-SQL-query.png 704w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-New-SQL-query-300x183.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"988\" height=\"583\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-SQL-Statement.png\" alt=\"Zettaflow SQL Statement\" class=\"wp-image-238\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-SQL-Statement.png 988w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-SQL-Statement-300x177.png 300w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-SQL-Statement-768x453.png 768w\" sizes=\"auto, (max-width: 988px) 100vw, 988px\" \/><\/figure>\n<\/div>\n\n\n<p>After running the query we are getting the following result:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"684\" height=\"470\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Data-Flow.png\" alt=\"Zettaflow Data Flow\" class=\"wp-image-240\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Data-Flow.png 684w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Data-Flow-300x206.png 300w\" sizes=\"auto, (max-width: 684px) 100vw, 684px\" \/><\/figure>\n<\/div>\n\n\n<p>Next, we need to create the Data URL (we are using the same name &#8211; the <strong>Chicago flights<\/strong>). Here we have links ready for sharing:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"996\" height=\"362\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Links.png\" alt=\"Zettaflow Links\" class=\"wp-image-243\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Links.png 996w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Links-300x109.png 300w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Links-768x279.png 768w\" sizes=\"auto, (max-width: 996px) 100vw, 996px\" \/><\/figure>\n<\/div>\n\n\n<p>We use the CSV URL <\/p>\n\n\n\n<p><a href=\"https:\/\/overfetch.com\/r\/data-url\/1d1ee3e79c73\/nC1jR26cd642aHCGmyFVbY7Pp8mbRj1nIYmCSEQWPwB7Dhku.csv\" target=\"_blank\" rel=\"noopener\" title=\"\">https:\/\/overfetch.com\/r\/nC1jR26cd642aHCGmyFVbY7Pp8mbRj1nIYmCSEQWPwB7Dhku.csv<\/a><\/p>\n\n\n\n<p>to load the data into Excel,&nbsp;<\/p>\n\n\n\n<p>and the Google Sheets formula <\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0);color:#6a996c\" class=\"has-inline-color\">=IMPORTDATA(&#8220;https:\/\/overfetch.com\/r\/data-url\/1d1ee3e79c73\/nC1jR26cd642aHCGmyFVbY7Pp8mbRj1nIYmCSEQWPwB7Dhku.csv&#8221;)<\/mark><\/p>\n\n\n\n<p>to load the data into Google Sheets.<\/p>\n\n\n\n<p>See how it works:&nbsp;<\/p>\n\n\n\n<p>This is our CSV:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"930\" height=\"560\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-CSV.png\" alt=\"Zettaflow CSV\" class=\"wp-image-250\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-CSV.png 930w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-CSV-300x181.png 300w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-CSV-768x462.png 768w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/figure>\n<\/div>\n\n\n<p>We may open a worksheet in <strong>Excel <\/strong>and from the <strong>Data <\/strong>tab select <strong>Get External Data<\/strong>, and click on <strong>From Web<\/strong>. Further, we will need to paste the link, adjust the separator if required, and import the data:&nbsp;&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"965\" height=\"635\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-01.png\" alt=\"Zettaflow to Excel\" class=\"wp-image-252\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-01.png 965w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-01-300x197.png 300w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-01-768x505.png 768w\" sizes=\"auto, (max-width: 965px) 100vw, 965px\" \/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"948\" height=\"706\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-02.png\" alt=\"Zettaflow to Excel 02\" class=\"wp-image-254\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-02.png 948w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-02-300x223.png 300w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-02-768x572.png 768w\" sizes=\"auto, (max-width: 948px) 100vw, 948px\" \/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"931\" height=\"673\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-03.png\" alt=\"Zettaflow to Excel 03\" class=\"wp-image-256\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-03.png 931w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-03-300x217.png 300w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Excel-03-768x555.png 768w\" sizes=\"auto, (max-width: 931px) 100vw, 931px\" \/><\/figure>\n<\/div>\n\n\n<p>Or we may want to open <strong>Google Sheets <\/strong>and simply paste the Google Sheets formula in the cell that we wish to:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"603\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Google-Sheets.png\" alt=\"Zettaflow to Google Sheets\" class=\"wp-image-258\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Google-Sheets.png 800w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Google-Sheets-300x226.png 300w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Google-Sheets-768x579.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n<\/div>\n\n\n<p>Once done we may want to build say a <strong>bar chart <\/strong>based on the data:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"587\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Bar-Chart-1024x587.png\" alt=\"Zettaflow Bar Chart\" class=\"wp-image-262\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Bar-Chart-1024x587.png 1024w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Bar-Chart-300x172.png 300w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Bar-Chart-768x440.png 768w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-Bar-Chart.png 1172w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>&nbsp;<\/p>\n\n\n\n<p>Sure we may use CSV URL for other tools, such as <strong>Jupyter<\/strong>:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"758\" src=\"https:\/\/zettaflow.tech\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Jupyter-1024x758.png\" alt=\"Zettaflow to Jupyter\" class=\"wp-image-260\" srcset=\"https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Jupyter-1024x758.png 1024w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Jupyter-300x222.png 300w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Jupyter-768x568.png 768w, https:\/\/tapegraph.io\/blog\/wp-content\/uploads\/2020\/07\/Zettaflow-to-Jupyter.png 1180w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p>Why not share the result with other stakeholders using the basic features of Google Sheets or Excel?<\/p>\n\n\n\n<p>Check this link:&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1VBEt1ANOBSWCmP_2-rq8Gyw9ZMbvZVhP5lvlw_6S7bs\/edit?usp=sharing\" target=\"_blank\" rel=\"noopener\" title=\"\">https:\/\/docs.google.com\/spreadsheets\/d\/1VBEt1ANOBSWCmP_2-rq8Gyw9ZMbvZVhP5lvlw_6S7bs<\/a><\/p>\n\n\n\n<p>We can click the menu button in Google Sheets in the upper right corner of the chart and publish our chart to the web in a graphical or interactive format:<\/p>\n\n\n\n<iframe loading=\"lazy\" width=\"600\" height=\"371\" seamless=\"\" frameborder=\"0\" scrolling=\"no\" src=\"https:\/\/docs.google.com\/spreadsheets\/d\/e\/2PACX-1vQEuTOIL0mUmIXYI1fRJujkM5TbQ3-jaDQL8vG-GLEbbYT7s52VpCRLNqfRCTpgkTVLqFXoT2qmYJEw\/pubchart?oid=140860641&amp;format=interactive\"><\/iframe>\n\n\n\n<p class=\"has-text-align-center\"><em>Interactive Embedded Google Sheets Bar Chart<\/em><\/p>\n\n\n\n<p>We may share our visualization via the link:<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/e\/2PACX-1vQEuTOIL0mUmIXYI1fRJujkM5TbQ3-jaDQL8vG-GLEbbYT7s52VpCRLNqfRCTpgkTVLqFXoT2qmYJEw\/pubchart?oid=140860641&amp;format=interactive\" target=\"_blank\" rel=\"noopener\" title=\"\">https:\/\/docs.google.com\/spreadsheets\/d\/e\/2PACX-1vQEuTOIL0mUmIXYI1fRJujkM5TbQ3-jaDQL8vG-GLEbbYT7s52VpCRLNqfRCTpgkTVLqFXoT2qmYJEw\/pubchart?oid=140860641&amp;format=interactive<\/a><\/p>\n\n\n\n<p>You as well as your business users may work with this data in the spreadsheets, or you may stick with <strong>SQL <\/strong>because amazingly both <strong>Excel <\/strong>and <strong>Google Sheets <\/strong>even in their free version support the Refresh function.&nbsp;<\/p>\n\n\n\n<p>Having all these why not try building a kind of real-time dashboard in the spreadsheets?!&nbsp;<\/p>\n\n\n\n<p>However, this is the subject of another post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Link Your SQL Queries to Spreadsheets<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[14,28,27,16],"tags":[43,40,9,56,5,6,42,7,3],"class_list":["post-234","post","type-post","status-publish","format-standard","hentry","category-visualization","category-how-to-guides","category-integrations","category-tech","tag-beginner","tag-dashboards","tag-data","tag-data-pipeline","tag-excel","tag-googlesheets","tag-how-to","tag-sql","tag-visualization"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/tapegraph.io\/blog\/wp-json\/wp\/v2\/posts\/234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tapegraph.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tapegraph.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tapegraph.io\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/tapegraph.io\/blog\/wp-json\/wp\/v2\/comments?post=234"}],"version-history":[{"count":47,"href":"https:\/\/tapegraph.io\/blog\/wp-json\/wp\/v2\/posts\/234\/revisions"}],"predecessor-version":[{"id":1020,"href":"https:\/\/tapegraph.io\/blog\/wp-json\/wp\/v2\/posts\/234\/revisions\/1020"}],"wp:attachment":[{"href":"https:\/\/tapegraph.io\/blog\/wp-json\/wp\/v2\/media?parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tapegraph.io\/blog\/wp-json\/wp\/v2\/categories?post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tapegraph.io\/blog\/wp-json\/wp\/v2\/tags?post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}