<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: rweebs</title>
    <description>The latest articles on DEV Community by rweebs (@rweebs).</description>
    <link>https://dev.to/rweebs</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F893168%2Fe6a4d4ce-3062-4d41-9728-a299bd6c7537.jpeg</url>
      <title>DEV Community: rweebs</title>
      <link>https://dev.to/rweebs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rweebs"/>
    <language>en</language>
    <item>
      <title>How to make Google Sheets as QuickSight Data Source</title>
      <dc:creator>rweebs</dc:creator>
      <pubDate>Sun, 17 Jul 2022 17:56:29 +0000</pubDate>
      <link>https://dev.to/rweebs/how-to-make-google-sheets-as-quicksight-data-source-569j</link>
      <guid>https://dev.to/rweebs/how-to-make-google-sheets-as-quicksight-data-source-569j</guid>
      <description>&lt;p&gt;There are cases where you want to connect &lt;a href="https://aws.amazon.com/quicksight/"&gt;AWS QuickSight&lt;/a&gt; to pull data from Google Sheets to suit your business. In fact many business people love to see data in a spreadsheet instead of having to query database. But, as of today AWS QuickSight doesn't have a Google Sheet connector out of the box. To be able to use Google Sheet as data source we need to make a script to export the data to csv and put it in the S3.&lt;/p&gt;

&lt;p&gt;In this post, I will demonstrate to you how to use Google Sheets as Data Source for QuickSight.&lt;/p&gt;

&lt;h2&gt;
  
  
  Program overview
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--idTbsvWw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hekekv8s5pzvu627exq6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--idTbsvWw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hekekv8s5pzvu627exq6.jpg" alt="Image description" width="721" height="373"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Setup AWS AccessKey and SecretKey that enable access to read and write to specific S3 Bucket.&lt;/li&gt;
&lt;li&gt;The source code is available here : &lt;a href="https://github.com/rweebs/quicksights-gsheet-demo-/tree/master/gsheet_to_quicksights"&gt;https://github.com/rweebs/quicksights-gsheet-demo-/tree/master/gsheet_to_quicksights&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Steps:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to Apps Script on the Google Spreadsheet.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iLZFaGNa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/spnjsjnp4nqjl5k8pmmu.png" alt="Image description" width="880" height="420"&gt;
&lt;/li&gt;
&lt;li&gt;Copy all the code that was given in this repo, you can see the final configuration below.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--60-XMa6k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8olz2mez13fdscbg2tc.png" alt="Image description" width="880" height="465"&gt;
&lt;/li&gt;
&lt;li&gt;Navigate to the project settings.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0i69sh8b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icp3jzv1teu9nth5g7tb.png" alt="Image description" width="844" height="744"&gt;
&lt;/li&gt;
&lt;li&gt;Add the AccessKeyId, Bucket Name, and Secret AccessKey to the script properties. This will protect your secrets for security reason.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y9Nou1ge--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ldzoprn3adyph4j6wduo.png" alt="Image description" width="808" height="1398"&gt;
&lt;/li&gt;
&lt;li&gt;Navigate to Triggers
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lCjmSq8U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ehlqv486l3014bikjd9t.png" alt="Image description" width="626" height="774"&gt;
&lt;/li&gt;
&lt;li&gt;This is the trigger implementation you can make the program to sync on the given time, such as sync every minutes or with other configuration.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9ZRea1X0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0e4q4jbkr37icodb1da.png" alt="Image description" width="880" height="925"&gt;
&lt;/li&gt;
&lt;li&gt;It will export every worksheet on the workbook into a different csv file on the bucket.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0Q0OYYAy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1im9xw7edjuyr4byvqzw.png" alt="Image description" width="880" height="772"&gt;
&lt;/li&gt;
&lt;li&gt;In Quicksight we can make our S3 Bucket as our data source.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AgrO3VLM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fxmovrh7ajh9d6s82j2z.png" alt="Image description" width="880" height="570"&gt;
&lt;/li&gt;
&lt;li&gt;This is how our manifest.json file looks like and needs to be uploaded.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xaV3AeRH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o9w05abfsychgkazgd2w.png" alt="Image description" width="880" height="491"&gt;
&lt;/li&gt;
&lt;li&gt;We can also preview the data here.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_FYgfeAG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c9p06p7xhy193vce4ej1.png" alt="Image description" width="880" height="457"&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ASyWK0gD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ocji31paqmxeh4cphooe.png" alt="Image description" width="880" height="433"&gt;
&lt;/li&gt;
&lt;li&gt;We also schedule a job to refresh our dataset hourly.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mTyDU_zQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/29cd9bvyew7b56nuf9su.png" alt="Image description" width="880" height="888"&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vgqn6Rmu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h00mh5r4hlf8tipjbqcg.png" alt="Image description" width="880" height="418"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How to export the data from QuickSight to Google Sheet?
&lt;/h2&gt;

&lt;p&gt;So as of today the only data that can be exported out of QuickSight is only for Visualization data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4-1eR3vp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s7dc52eb3lffwjo7olo3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4-1eR3vp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s7dc52eb3lffwjo7olo3.png" alt="Image description" width="880" height="596"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So when we already download the csv file. We can upload the file to s3 and make a lambda function to make a new worksheet with the title of the csv file to the Google Sheet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Setup Service Account in GCP.&lt;/li&gt;
&lt;li&gt;The source code is available here: &lt;a href="https://github.com/rweebs/quicksights-gsheet-demo-/tree/master/s3_to_gsheet"&gt;https://github.com/rweebs/quicksights-gsheet-demo-/tree/master/s3_to_gsheet&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Steps:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Share your spreadsheet with the service account email.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W2eRAe2O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hver9ond2c7n3275u2e5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W2eRAe2O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hver9ond2c7n3275u2e5.png" alt="Image description" width="880" height="926"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the spreadsheetId the Id is the one that I select for example&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cT6xf4U1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c9rzlwwkwcu3gxpw3baf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cT6xf4U1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c9rzlwwkwcu3gxpw3baf.png" alt="Image description" width="880" height="53"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the service account private key to key.json file on lambda_function directory&lt;/li&gt;
&lt;li&gt;Zip the lambda_function directory&lt;/li&gt;
&lt;li&gt;Upload the zip to lambda and Add the spreadsheetId that you copy to the environment variable
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tntfpt_b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tufyzja03fsv1nsz0uph.png" alt="Image description" width="880" height="668"&gt;
&lt;/li&gt;
&lt;li&gt;Make sure the directory looks like this with lambda_function.py in the root directory
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l_7ZOhDX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mxh7bzuarownirtx9rls.png" alt="Image description" width="562" height="858"&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add Trigger to the Lambda from specific s3 bucket and don't forget to set the object format .csv&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ukxwNwfe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sqe6grs49mqadvxaxoka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ukxwNwfe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sqe6grs49mqadvxaxoka.png" alt="Image description" width="880" height="695"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The flow of the program looks like this:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When there is a object create event, it will invoke the lambda function to make a new worksheet with the title of the filename of the csv file in this example address, if there is address workbook available it will clear all the cell within the sheet and replace it with the new one as seen at the last image&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zBeHRmgo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qy53kqz8ra4unf6k6b83.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zBeHRmgo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qy53kqz8ra4unf6k6b83.png" alt="Image description" width="880" height="701"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fTunm4ZT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zuncukbb7uvqztjd7hgt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fTunm4ZT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zuncukbb7uvqztjd7hgt.png" alt="Image description" width="880" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---z_-6PoN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yhsejc05d3n4qsmbsvu0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---z_-6PoN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yhsejc05d3n4qsmbsvu0.png" alt="Image description" width="880" height="769"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SKz1wm1I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/199glwydszqxpslicep1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SKz1wm1I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/199glwydszqxpslicep1.png" alt="Image description" width="880" height="863"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  PS. Just make sure in the configuration runtime at minimum 30 seconds instead of 3 seconds. And make sure the lambda role has access to List and Get Object at the bucket
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sCI9uucr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3884gnj6exq382zkv9a3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sCI9uucr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3884gnj6exq382zkv9a3.png" alt="Image description" width="880" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;We can use Google Sheet as the data source for QuickSight with some effort to make it automated. We can also use for example lambda and Cloudwatch to make a cronjob for exporting csv file. Also use Athena to query all the csv file on S3. Until the feature is available to make Google Sheet as data source out of the box. This is one of the option we can do.&lt;/p&gt;

&lt;p&gt;Otherwise, hopefully this did work for you and you can now happly using Google Sheet as data source in Quicksight! &lt;/p&gt;

</description>
      <category>aws</category>
      <category>quicksight</category>
      <category>googlesheet</category>
    </item>
  </channel>
</rss>
