<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>google Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/google/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/google/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Thu, 17 Apr 2025 14:50:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.4</generator>

<image>
	<url>https://zappysys.com/blog/wp-content/uploads/2023/01/cropped-zappysys-symbol-large-32x32.png</url>
	<title>google Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/google/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to write/update Google Sheet in SSIS</title>
		<link>https://zappysys.com/blog/write-update-google-sheet-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 11 Dec 2019 12:29:14 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[Connection]]></category>
		<category><![CDATA[Destination]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oledb]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[put]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[sheet]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[spreadsheet]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[transform]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[variable]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[write]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=8475</guid>

					<description><![CDATA[<p>Introduction In this post, you will learn How to write/update Google Sheet in SSIS. We will use drag and drop REST API connectors from SSIS PowerPack. No need to download any SDK or learn programming languages (e.g. JAVA, C#, Ruby, Python) when you use SSIS PowerPack Connectors. We will use the Google Drive API and Google Sheet API [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/write-update-google-sheet-ssis/">How to write/update Google Sheet in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span id="Introduction">Introduction</span></h2>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/google-sheets-connector/">API Connector for Google Sheets Online</a> which makes it much simpler to <strong>Read/Write  Google Sheets Data in SSIS</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).</p>
</div></div>
<a href="https://zappysys.com/blog/wp-content/uploads/2016/09/google-sheets-api-integration.png"><img loading="lazy" decoding="async" class="size-thumbnail wp-image-1670 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2016/09/google-sheets-api-integration-150x150.png" alt="" width="150" height="150" /></a>In this post, you will learn How to write/update Google Sheet in SSIS. We will use drag and drop REST API connectors from <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a>. No need to download any SDK or learn programming languages (e.g. JAVA, C#, Ruby, Python) when you use SSIS PowerPack Connectors. We will use the Google Drive API and Google Sheet API to write and update Google Spreadsheet in a few clicks (using OAuth 2.0 connection in SSIS).</p>
<p>In this tutorial, we will use the <a href="https://zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" target="_blank" rel="noopener">REST API Task</a> to call some API. We will use the <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth connection</a> along the <a href="https://zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" target="_blank" rel="noopener">REST API Task</a> to write / update data to Google Spreadsheet.</p>
<p>&nbsp;</p>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:</p>
<ol>
<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from Microsoft site</a>).</li>
<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
<li>Make sure <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>).</li>
<li>Credentials of Google API.</li>
</ol>
<h2>Component Mention in this article</h2>
<div class="su-table su-table-alternate">
<table style="height: 44px;width: 307px">
<tbody>
<tr style="height: 22px">
<td style="height: 22px;width: 1px"><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-generator-transform/ssis-json-generator-transform.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-3074" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-generator-transform/ssis-json-generator-transform.png" alt="" width="40" height="40" /></a></td>
<td style="height: 22px;width: 247px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator Transform</a></td>
</tr>
<tr style="height: 22px">
<td style="height: 22px;width: 1px"><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/web-api-destination/ssis-web-api-destination.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-3074" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/web-api-destination/ssis-web-api-destination.png" alt="" width="40" height="40" /></a></td>
<td style="height: 22px;width: 247px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></td>
</tr>
<tr style="height: 22px">
<td style="height: 22px;width: 1px"><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-3074" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task.png" alt="" width="40" height="40" /></a></td>
<td style="height: 22px;width: 247px"><a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a></td>
</tr>
</tbody>
</table>
</div>
<h2><span id="Create_Google_API_Project">Create a Google API Project</span></h2>
<p>The first step to access any Google API is to create an API Project in Google Console. If you don’t want to go through this then Skip this Step-1 and in the next section select the Default OAuth App option on OAth Connection Manager (This is the easiest option for now unless you want to use your own OAuth App).</p>
<p><a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">Check this article</a> for step-by-step instructions. When you follow these instructions make sure you <a href="https://console.developers.google.com/apis/api/sheets.googleapis.com/overview?project=603281348663" target="_blank" rel="noopener">enable Google Sheet API.</a></p>
<h2><span id="Create_OAuth_Connection_Manager_in_SSIS">Create OAuth Connection Manager in SSIS</span></h2>
<p>Once you create a Google API project and obtained a Client ID and Client Secret your next step is to create <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> in SSIS. ZappySys OAuth connection manager comes with many predefined OAuth Providers (e.g. Facebook, Twitter, Google, etc) but you can also define custom OAuth settings for any OAuth enabled API.</p>
<p>To create SSIS OAuth 2.0 Connection for Google API perform the following steps.</p>
<ol>
<li>Download and Install SSIS PowerPack.</li>
<li>Create a new SSIS Package.</li>
<li>Right-click in Connection Manager Area and Click “New Connection”.</li>
<li>When prompted select ZS-OAUTH connection type, On the OAuth Connection Manager Select Provider=Google.</li>
<li>Click here to <a href="https://console.developers.google.com/apis/credentials" target="_blank" rel="noopener">create credentials.</a> Then select the “Use Custom OAuth App” option and enter your ClientID, ClientSecret.</li>
<li>In the Scopes <strong>enter below scopes</strong> (or click Select Scopes). This will allow read/write access to Drive Files or Sheet (E.g. Reading file content / Export file to CSV). You can use the Scope browser to see many other available permissions. For more information click <a href="https://developers.google.com/sheets/api/guides/authorizing#OAuth2Authorizing" target="_blank" rel="noopener">here.</a><br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/spreadsheets.readonly</pre>
</li>
<li>Click on the Generate Token button.
<div id="attachment_8479" style="width: 1036px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-google-oauth-connection-google-drive-api-access-file.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8479" class="wp-image-8479 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-google-oauth-connection-google-drive-api-access-file.png" alt="SSIS OAuth Connection Manager – Access Google Drive API using OAuth 2.0" width="1026" height="653" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-google-oauth-connection-google-drive-api-access-file.png 1026w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-google-oauth-connection-google-drive-api-access-file-300x191.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-google-oauth-connection-google-drive-api-access-file-768x489.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-google-oauth-connection-google-drive-api-access-file-1024x652.png 1024w" sizes="(max-width: 1026px) 100vw, 1026px" /></a><p id="caption-attachment-8479" class="wp-caption-text">SSIS OAuth Connection Manager – Access Google Drive API using OAuth 2.0</p></div></li>
<li>You will see UI as below… Click Allow (You may have to scroll to see that button sometimes).</li>
<li>Click on Test Connection to see the connection is working and click on the OK button to save configure setting UI.</li>
</ol>
<h2><span id="Find_Google_Sheet_ID_for_API_call">Find Google Sheet ID for API calls</span></h2>
<p>Before we can write or update Sheet data in SSIS we need to know Google Driver File ID. We will use this ID in the next few sections.</p>
<p>The easiest way to find File ID is to look at the URL like below. If you need to know ID at runtime dynamically then refer to the last section.</p>
<div id="attachment_8450" style="width: 806px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8450" class="wp-image-8450 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call.png" alt="Get Google Drive File ID for API call (Sheet ID)" width="796" height="286" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call.png 796w, https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call-300x108.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call-768x276.png 768w" sizes="(max-width: 796px) 100vw, 796px" /></a><p id="caption-attachment-8450" class="wp-caption-text">Get Google Drive File ID for API call (Sheet ID)</p></div>
<h2>Create Variables to make dynamic URL</h2>
<ol>
<li>Here, we are going to make a Dynamic URL value.</li>
<li>In Visual Studio Project Right Click on Design Panel, Select Variables.
<div style="width: 426px" class="wp-caption aligncenter"><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/ssis-create-variable.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/ssis-create-variable.png" alt="Create Variables" width="416" height="294" /></a><p class="wp-caption-text">Create Variables</p></div></li>
<li>Let&#8217;s Create Variables with correct DataType and Value. In variable &#8220;<strong>varRange</strong>&#8221; set only the starting point(<strong>Sheet1!A2</strong>) of data if you don&#8217;t know the ending point and leave the first-row for giving header row later or click <a href="https://zappysys.com/blog/write-update-google-sheet-ssis/#Update_Google_Sheet_header_cells_manually" target="_blank" rel="noopener">here.</a><br />
<a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-create-variable.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="aligncenter wp-image-8547 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-create-variable.png" alt="Create Variables with correct datatype and values" width="863" height="209" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-create-variable.png 863w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-create-variable-300x73.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-create-variable-768x186.png 768w" sizes="(max-width: 863px) 100vw, 863px" /></a></li>
</ol>
<h2>Write SQL Server data to Google Spreadsheet</h2>
<p>Now let’s look at a real-world example. How to write data from SQL Server table or other source and send to Google Sheet using Web API Destination.</p>
<ol>
<li>Drag and Drop SSIS Data Flow Task from SSIS Toolbox.
<div id="attachment_8028" style="width: 470px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8028" class="wp-image-8028 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png" alt="Dragging and dropping Data Flow Task into Control Flow" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /></a><p id="caption-attachment-8028" class="wp-caption-text">Dragging and dropping Data Flow Task into Control Flow</p></div></li>
<li>Double click on the Data Flow task to see the Data Flow designer surface.</li>
<li>Here, In Visual Studio, drag and drop the OLE DB Source, JSON Generator Transform and Web API Destination in the design surface and join the components with the blue arrow.
<div id="attachment_8491" style="width: 611px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-drag-drop-json-generator-web-api-destination.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8491" class="wp-image-8491 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-drag-drop-json-generator-web-api-destination.png" alt="Drag and Drop OLE DB Source, JSON Generator Transform and Web API Destination" width="601" height="369" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-drag-drop-json-generator-web-api-destination.png 601w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-drag-drop-json-generator-web-api-destination-300x184.png 300w" sizes="(max-width: 601px) 100vw, 601px" /></a><p id="caption-attachment-8491" class="wp-caption-text">Drag and Drop OLE DB Source, JSON Generator Transform, and Web API Destination</p></div></li>
<li>Here, you can use our Free ZS Dummy Data Source too. Click <a href="https://zappysys.com/products/ssis-powerpack/dummy-data-source-free/" target="_blank" rel="noopener">here</a> for more information.</li>
<li>But, we are going through OLE DB Source so we need OLEDB Connection.</li>
</ol>
<h3>Create OLE DB Connection</h3>
<ol>
<li>Lets, create the OLE DB Connection.</li>
<li>Let&#8217;s, Right-click on Connection Managers Panel to Create OLEDB Connection, so you can use Source and Context Menu will appear, Select New OLEDB Connection from the Context Menu.
<div style="width: 485px" class="wp-caption aligncenter"><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/oledb-connection-manager/ssis-new-oledb-connection-step-1.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/oledb-connection-manager/ssis-new-oledb-connection-step-1.png" alt="Create OLE DB Connection" width="475" height="353" /></a><p class="wp-caption-text">Create OLE DB Connection</p></div></li>
<li>Now, click on New Button to create Connection.
<div style="width: 665px" class="wp-caption aligncenter"><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/oledb-connection-manager/ssis-new-oledb-connection-step-2.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/oledb-connection-manager/ssis-new-oledb-connection-step-2.png" alt="Create New Connection" width="655" height="558" /></a><p class="wp-caption-text">Create New Connection</p></div></li>
<li>Let&#8217;s Configure Connection Manager, just Follow steps one by one as we have created.
<div style="width: 730px" class="wp-caption aligncenter"><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/oledb-connection-manager/ssis-new-oledb-connection-step-3.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/oledb-connection-manager/ssis-new-oledb-connection-step-3.png" alt="Configure OLE DB Connection" width="720" height="625" /></a><p class="wp-caption-text">Configure OLE DB Connection</p></div></li>
<li>Click on Test Connection to see correct configure it.</li>
<li>Click on the OK button to save connection configure setting UI.</li>
</ol>
<h3>Configure JSON Generator Transform</h3>
<ol>
<li>Double click on JSON Generator Transform to configure it.</li>
<li>Set Output Mode to <strong>Single Dataset Array</strong>. Right-click on Mappings, select Add Static Element then enter Name: &#8220;<strong>range</strong>&#8221; and Select variable we have created for value.
<div id="attachment_8492" style="width: 929px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-static-value.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8492" class="wp-image-8492 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-static-value.png" alt="Configure JSON Generator Transform - Add Static Value" width="919" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-static-value.png 919w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-static-value-300x238.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-static-value-768x610.png 768w" sizes="(max-width: 919px) 100vw, 919px" /></a><p id="caption-attachment-8492" class="wp-caption-text">Configure JSON Generator Transform &#8211; Add Static Value</p></div></li>
<li>Again, Right-click on Mappings, select Add Static Element then enter Name: &#8220;<strong>majorDimension</strong>&#8221; and Value: &#8220;<strong>ROWS</strong>&#8220;.
<div id="attachment_8493" style="width: 946px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-static-value-2.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8493" class="wp-image-8493 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-static-value-2.png" alt="Configure JSON Generator Transform - Add Static Value" width="936" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-static-value-2.png 936w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-static-value-2-300x234.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-static-value-2-768x599.png 768w" sizes="(max-width: 936px) 100vw, 936px" /></a><p id="caption-attachment-8493" class="wp-caption-text">Configure JSON Generator Transform &#8211; Add Static Value</p></div></li>
<li>Now, Right-click on Mappings, select Add Document Array, Check to Treat as <strong>2D array</strong> option and enter Element Name as &#8220;<strong>values</strong>&#8220;.
<div id="attachment_8494" style="width: 1047px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-document-array.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8494" class="wp-image-8494 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-document-array.png" alt="Configure JSON Generator Transform - Add Document Array" width="1037" height="764" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-document-array.png 1037w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-document-array-300x221.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-document-array-768x566.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-document-array-1024x754.png 1024w" sizes="(max-width: 1037px) 100vw, 1037px" /></a><p id="caption-attachment-8494" class="wp-caption-text">Configure JSON Generator Transform &#8211; Add Document Array</p></div></li>
<li>Then, right-click on Document Array, select <strong>Add elements</strong> &gt; Select <strong>Add Multiple Columns</strong> and check on columns you like to add.
<div id="attachment_8495" style="width: 1047px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-addelement.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8495" class="wp-image-8495 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-addelement.png" alt="Configure JSON Generator Transform - Add Element" width="1037" height="764" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-addelement.png 1037w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-addelement-300x221.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-addelement-768x566.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-json-generator-addelement-1024x754.png 1024w" sizes="(max-width: 1037px) 100vw, 1037px" /></a><p id="caption-attachment-8495" class="wp-caption-text">Configure JSON Generator Transform &#8211; Add Element</p></div></li>
<li>Click on the OK button to save JSON Generator Transform configure setting UI.</li>
</ol>
<h3>Configure Web API Destination</h3>
<ol>
<li>Double click on Web API Destination to configure it.</li>
<li>Select the OAuth connection manager created in an earlier section (Assuming you had all scopes with write permission).</li>
<li>In the Setting tab,
<ol>
<li>In URL, Generate Dynamic URL like below. Change Sheet ID, Range designator(including Sheet name) and API URL Parameters as per your need.<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{{User::varGoogleSpreadsheetID}}/values/{{User::varRange}}:{{User::varSpreadsheetValues}}?valueInputOption={{User::varValueInputOption}}</pre>
<strong>Example URL without variables (some part masked with xxxxxxxx):</strong><br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6xxxxxxxxCHrORJc/values/Sheet1!A2:B4:append?valueInputOption=USER_ENTERED</pre>
</li>
<li>Change Request Method to <strong>POST.</strong></li>
<li>Select JSON Generator variable into <strong>Body (Request Data)</strong> or you can select <strong>Input column</strong> for <strong>Body </strong>(JSON Generator Output).</li>
<li>Set <strong><strong><strong>application/JSON </strong></strong></strong>to Body Content-type.
<div id="attachment_8497" style="width: 1214px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-web-api-destination.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8497" class="wp-image-8497 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-web-api-destination.png" alt="Configure Web API Destination" width="1204" height="725" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-web-api-destination.png 1204w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-web-api-destination-300x181.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-web-api-destination-768x462.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-configure-web-api-destination-1024x617.png 1024w" sizes="(max-width: 1204px) 100vw, 1204px" /></a><p id="caption-attachment-8497" class="wp-caption-text">Configure Web API Destination</p></div></li>
</ol>
</li>
<li>Click on the OK button to save Web API Destination configure setting UI.</li>
<li>That&#8217;s all, You are ready to Run or Execute Task and verify data into Google spreadsheet. Now update header row values for click <a href="https://zappysys.com/blog/write-update-google-sheet-ssis/#Update_Google_Sheet_header_cells_manually">here.</a>
<div id="attachment_8530" style="width: 1147px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-execute-1.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8530" class="wp-image-8530 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-execute-1.png" alt="Run or Execute Package and verify data into Google Spreadsheet" width="1137" height="556" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-execute-1.png 1137w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-execute-1-300x147.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-execute-1-768x376.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-execute-1-1024x501.png 1024w" sizes="(max-width: 1137px) 100vw, 1137px" /></a><p id="caption-attachment-8530" class="wp-caption-text">Run or Execute Package and verify data into Google Spreadsheet</p></div></li>
</ol>
<h2><span id="Write_data_to_Google_Spread_Sheet">Append data to Google SpreadSheet using REST API Task</span></h2>
<p>Now let&#8217;s look at how to write to Google SpreadSheet. To write multiple rows in a single request. Also, check this link to <a href="https://developers.google.com/sheets/api/guides/values" target="_blank" rel="noopener">learn more</a>.</p>
<p>For more information, you can see the <a href="https://developers.google.com/sheets/api/samples/writing" target="_blank" rel="noopener">example here</a>. For parameter, detail review this API documentation.</p>
<p>You can use<a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener"> SSIS REST API Task</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a> to achieve the Spreadsheet write scenario. For a simple example, let&#8217;s use the REST API Task.</p>
<ol>
<li>Drag and Drop ZS REST API Task on the control flow designer.
<div id="attachment_3777" style="width: 577px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-3777" class="wp-image-3777 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png" alt="Drag and Drop REST API Task" width="567" height="297" srcset="https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin.png 567w, https://zappysys.com/blog/wp-content/uploads/2018/05/ssis-rest-api-task-share-post-on-linkedin-300x157.png 300w" sizes="(max-width: 567px) 100vw, 567px" /></a><p id="caption-attachment-3777" class="wp-caption-text">Drag and Drop REST API Task</p></div></li>
<li>Double click on ZS REST API Task to configure it.</li>
<li>In the Request Settings tab,
<ol>
<li>set Request URL Access Mode to Url from a connection. Select OAuth Connection from the dropdown (Same connection we created in the previous section).</li>
<li>Enter the URL below. Change Sheet ID, Range designator(including Sheet name) and API URL Parameters as per your need.<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{{User::varGoogleSpreadsheetID}}/values/{{User::varRange}}:{{User::varSpreadsheetValues}}?valueInputOption={{User::varValueInputOption}}</pre>
<strong>Example URL without variables (some part masked with xxxxxxxx):</strong><br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6xxxxxxxxCHrORJc/values/Sheet1!A1:append?valueInputOption=USER_ENTERED</pre>
</li>
<li>Change Request Method to <strong>POST.</strong></li>
<li>Enter Request Body as below<br />
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff8b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>Note:</strong> For example purpose, we included header line in data cells but in the real-world header may already exist in the sheet.</div></div>
<pre class="crayon-plain-tag">{
  "range": "{{User::varRange}}",
  "majorDimension": "ROWS",
  "values": [
    ["Item", "Cost", "Stocked", "Ship Date"],
    ["Wheel", "$20.50", "4", "3/1/2016"],
    ["Door", "$15", "2", "3/15/2016"],
    ["Engine", "$100", "1", "3/20/2016"],
    ["Totals", "=SUM(B2:B4)", "=SUM(C2:C4)", "=MAX(D2:D4)"]
  ]
}</pre>
</li>
<li>Change Request Content type to <strong><strong><strong>application/JSON.</strong></strong></strong>
<div id="attachment_8482" style="width: 1335px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-post-google-spreadsheet-using-rest-api-oauth.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8482" class="wp-image-8482 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-post-google-spreadsheet-using-rest-api-oauth.png" alt="Write data to Google SpreadSheet using REST API Task (OAuth 2.0 Connection)" width="1325" height="762" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-post-google-spreadsheet-using-rest-api-oauth.png 1325w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-post-google-spreadsheet-using-rest-api-oauth-300x173.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-post-google-spreadsheet-using-rest-api-oauth-768x442.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-post-google-spreadsheet-using-rest-api-oauth-1024x589.png 1024w" sizes="(max-width: 1325px) 100vw, 1325px" /></a><p id="caption-attachment-8482" class="wp-caption-text">Write data to Google SpreadSheet using REST API Task (OAuth 2.0 Connection)</p></div></li>
</ol>
</li>
<li>Click on the OK button to save REST API Task configure setting UI.</li>
<li>That&#8217;s all, You are ready to Run or Execute Task and verify data into Google spreadsheet.
<div id="attachment_8481" style="width: 1390px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-post-execute.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8481" class="wp-image-8481 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-post-execute.png" alt="Execute REST API Task and verify Google Spreadsheet data " width="1380" height="671" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-post-execute.png 1380w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-post-execute-300x146.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-post-execute-768x373.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-google-spreadsheet-using-rest-api-oauth-post-execute-1024x498.png 1024w" sizes="(max-width: 1380px) 100vw, 1380px" /></a><p id="caption-attachment-8481" class="wp-caption-text">Execute REST API Task and verify Google Spreadsheet data</p></div></li>
</ol>
<h2><span id="Update_Google_Sheet_Cells_8211_Single_Range_Set_Values_for_multiple_cells">Update Google Sheet Cells</span></h2>
<p>Now let’s look at the below example of updating multiple cells in google Spreadsheet. For more information, you can see the <a href="https://developers.google.com/sheets/api/samples/writing" target="_blank" rel="noopener">example here</a>. For parameter, detail review this API documentation.</p>
<p>You can use<a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener"> SSIS REST API Task</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a> to achieve the Spreadsheet Update scenario. For a simple example, let&#8217;s use the REST API Task.</p>
<h3>Update Google Sheet header cells manually</h3>
<ol>
<li>Drag and drop ZS REST API Tasks on the control flow designer.</li>
<li>Double click on the First REST API Task to configure it.</li>
<li>In the Request Settings tab,
<ol>
<li>Enter the URL below. Change Range designator(including Sheet name: <strong>Sheet1!A1</strong>) and API URL Parameters as per your need.<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{{User::varGoogleSpreadsheetID}}/values/{{User::varRange}}?valueInputOption={{User::varValueInputOption}}</pre>
<strong>Example URL without variables (some part masked with xxxxxxxx):</strong><br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6xxxxxxxxCHrORJc/values/Sheet1!A1?valueInputOption=USER_ENTERED</pre>
</li>
<li>Change Request Method to <strong>PUT.</strong></li>
<li>Enter Request Body as below<br />
<pre class="crayon-plain-tag">{
  "range": "{{User::varRange}}",
  "majorDimension": "ROWS",
  "values": [
    ["CustomerID", "CustomerName"]
  ]
}</pre>
</li>
</ol>
</li>
<li>Click on the OK button to save REST API Task configure setting UI.</li>
<li>That&#8217;s all, You are ready to Run or Execute Task and verify data into Google spreadsheet.<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-update-put-google-spreadsheet-using-rest-api-oauth.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-8532" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-update-put-google-spreadsheet-using-rest-api-oauth.png" alt="" width="1318" height="677" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-update-put-google-spreadsheet-using-rest-api-oauth.png 1318w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-update-put-google-spreadsheet-using-rest-api-oauth-300x154.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-update-put-google-spreadsheet-using-rest-api-oauth-768x394.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-update-put-google-spreadsheet-using-rest-api-oauth-1024x526.png 1024w" sizes="(max-width: 1318px) 100vw, 1318px" /></a></li>
</ol>
<h3><span id="Update_Google_Sheet_Cells_8211_Single_Range_Set_Values_for_multiple_cells">Single Range (Set Values for multiple cells)</span></h3>
<ol>
<li>Follow the previous section(write data to Google Spreadsheet) to update sheet data.</li>
<li>In the Request Settings tab,
<ol>
<li>Enter the URL below. Change Sheet ID, Range designator(including Sheet name) and API URL Parameters as per your need.<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{{User::varGoogleSpreadsheetID}}/values/{{User::varRange}}?valueInputOption={{User::varValueInputOption}}</pre>
<strong>Example URL without variables (some part masked with xxxxxxxx):</strong><br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6xxxxxxxxCHrORJc/values/Sheet1!A2:B4?valueInputOption=USER_ENTERED</pre>
</li>
<li>Change Request Method to <strong>PUT.</strong></li>
<li>Enter Request Body as below<br />
<pre class="crayon-plain-tag">{
  "range": "{{User::varRange}}",
  "majorDimension": "ROWS",
  "values": [
    ["Laptop", "$2000.50"],
    ["Mobile", "$1150"]
  ]
}</pre>
</li>
</ol>
</li>
<li>That&#8217;s all, click on the Test Request/Response button and verify data into Google spreadsheet.
<div id="attachment_8485" style="width: 1610px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-put-google-spreadsheet-using-rest-api-oauth.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8485" class="wp-image-8485 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-put-google-spreadsheet-using-rest-api-oauth.png" alt="Calling Google Sheet API to Update Multiple Cell Values" width="1600" height="860" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-put-google-spreadsheet-using-rest-api-oauth.png 1600w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-put-google-spreadsheet-using-rest-api-oauth-300x161.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-put-google-spreadsheet-using-rest-api-oauth-768x413.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-write-put-google-spreadsheet-using-rest-api-oauth-1024x550.png 1024w" sizes="(max-width: 1600px) 100vw, 1600px" /></a><p id="caption-attachment-8485" class="wp-caption-text">Calling Google Sheet API to Update Multiple Cell Values</p></div></li>
</ol>
<h2><span id="Write_data_to_Google_Spread_Sheet">Clear data to Google SpreadSheet using REST API Task</span></h2>
<h3 id="clear_a_sheet_of_all_values_while_preserving_formats">Clear a sheet of all values while preserving formats</h3>
<p>Lets clear a sheet of all values by REST API Task, Before processed we need sheet Id. So let&#8217;s get the SheetId by API Call. For more information about click <a href="https://developers.google.com/sheets/api/samples/sheet#clear_a_sheet_of_all_values_while_preserving_formats" target="_blank" rel="noopener">here.</a></p>
<ol>
<li>Drag and Drop two ZS REST API Tasks on the control flow designer and rename(Get Sheet ID and Clear Google Sheet of all values) it.</li>
<li>Double click on the First REST API(Get Sheet ID) Task to configure it.</li>
<li>In the Request Settings tab,
<ol>
<li>Enter the URL below. Change Sheet ID and API URL Parameters as per your need.<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{{User::varGoogleSpreadsheetID}}</pre>
<strong>Example URL without variables (some part masked with xxxxxxxx):</strong><br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6xxxxxxxxCHrORJc</pre>
</li>
<li>Change Request Method to <strong><strong>GET.<br />
</strong></strong><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-getsheetid.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="wp-image-8515 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-getsheetid.png" alt="REST API Task - Get Google Sheet ID" width="923" height="661" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-getsheetid.png 923w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-getsheetid-300x215.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-getsheetid-768x550.png 768w" sizes="(max-width: 923px) 100vw, 923px" /></a>REST API Task &#8211; Get Google Sheet ID</li>
</ol>
</li>
<li>Now go to Response Settings Tab, Select Response content Type Json and Write Response Content Filter Expression. Check on Save Response Content. Select Save Mode to Variable and Create a New variable or select it.<br />
<strong>Example of Response Content Filter Expression for the first Sheet : </strong><br />
<pre class="crayon-plain-tag">$.sheets.[0].properties.sheetId</pre>
<div id="attachment_8517" style="width: 757px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-savesheetid.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8517" class="wp-image-8517 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-savesheetid.png" alt="REST API Task - Save Google Sheet ID into Variable" width="747" height="613" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-savesheetid.png 747w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-savesheetid-300x246.png 300w" sizes="(max-width: 747px) 100vw, 747px" /></a><p id="caption-attachment-8517" class="wp-caption-text">REST API Task &#8211; Save Google Sheet ID into Variable</p></div></li>
<li>Now, click on the Test Request/Response to check configures are ok.</li>
<li>Click on the OK button to save REST API Task configure setting UI.</li>
<li>Double click on the second REST API(Clear Google Sheet of all values) Task to configure it.</li>
<li>In the Request Settings tab,
<ol>
<li>Enter the URL below. Change Sheet ID and API URL Parameters as per your need.<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{{User::varGoogleSpreadsheetID}}:batchUpdate</pre>
<strong>Example URL without variables (some part masked with xxxxxxxx):</strong><br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6xxxxxxxxCHrORJc:batchUpdate</pre>
</li>
<li>Change Request Method to <strong>POST. </strong>Enter Request Body as below and change a variable parameter as per your need.<br />
<pre class="crayon-plain-tag">{
  "requests": [
    {
      "updateCells": {
        "range": {
          "sheetId": {{User::varGoogleSheetID}}
        },
        "fields": "userEnteredValue"
      }
    }
  ]
}</pre>
</li>
<li>Change Request Content type to <strong>application/JSON.<br />
</strong></p>
<div id="attachment_8518" style="width: 1109px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8518" class="wp-image-8518 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth.png" alt="REST API Task Configure - Clear sheet of all values" width="1099" height="763" srcset="https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth.png 1099w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-300x208.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-768x533.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/12/ssis-clear-google-spreadsheet-using-rest-api-oauth-1024x711.png 1024w" sizes="(max-width: 1099px) 100vw, 1099px" /></a><p id="caption-attachment-8518" class="wp-caption-text">REST API Task Configure &#8211; Clear sheet of all values</p></div></li>
</ol>
</li>
<li>Click on the OK button to save REST API Task configure setting UI.</li>
<li>That&#8217;s all, You are ready to Run or Execute Task and verify data into Google spreadsheet.</li>
</ol>
<h3>Clears range cell values from a spreadsheet</h3>
<ol>
<li>Double click on REST API Task to configure it. Then, follow the way just like the previous section configures REST API Task.</li>
<li>Here you need to set the value of Variable &#8220;<strong>varSpreadsheetValues</strong>&#8221; to &#8220;<strong>clear</strong>&#8221; or you can change it directly in URL <strong>append to clear </strong>and value of variable &#8220;<strong>varRange</strong>&#8221; (Change cell range and sheet name) as per your need. For more information about it click <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/clear" target="_blank" rel="noopener">here.</a>
<ol>
<li>Enter the URL below. Change Sheet ID, Range designator(including Sheet name) and API URL Parameters as per your need.<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{{User::varGoogleSpreadsheetID}}/values/{{User::varRange}}:{{User::varSpreadsheetValues}}?valueInputOption={{User::varValueInputOption}}</pre>
<strong>Example URL without variables (some part masked with xxxxxxxx):</strong><br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6xxxxxxxxCHrORJc/values/Sheet1!A2:B4:clear?valueInputOption=USER_ENTERED</pre>
</li>
</ol>
</li>
<li>Change Request Method to <strong>POST.</strong></li>
<li>Enter Request Body as below<br />
<pre class="crayon-plain-tag">{}</pre>
</li>
<li>Change Request Content type to <strong><strong><strong>application/JSON.</strong></strong></strong></li>
<li>That&#8217;s all, click on the Test Request/Response button and verify data into Google spreadsheet.</li>
</ol>
<h2><span id="Conclusion">Conclusion</span></h2>
<p>Google Drive API and Google Sheets API provide a great way to automate file-related functionality. However, to call Google API  you have to use the SDK / coding approach (e.g. C#, Java, Python, Ruby). Luckily ZappySys <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> provides a great way to integrate any Google API call via simple drag and drop approach without coding. Try out yourself see how long it takes to call virtually any REST API.</p>
<h2>References</h2>
<p>Finally, you can use the following links for more information:</p>
<ul>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">JSON Generator Transform</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a></li>
<li>Help File:
<ul>
<li><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-json-generator-transform.htm" target="_blank" rel="noopener">JSON Generator Transform</a></li>
<li><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-web-api-destination.htm" target="_blank" rel="noopener">Web API Destination</a></li>
<li><a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-rest-api-web-service-task.htm" target="_blank" rel="noopener">REST API Task</a></li>
</ul>
</li>
</ul>
<p>The post <a href="https://zappysys.com/blog/write-update-google-sheet-ssis/">How to write/update Google Sheet in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Download AdWords report using Google Ads API, ODBC, and XML Driver</title>
		<link>https://zappysys.com/blog/download-adwords-report-using-google-api-odbc-xml-driver/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 24 Oct 2019 13:49:00 +0000</pubDate>
				<category><![CDATA[ODBC Drivers]]></category>
		<category><![CDATA[ODBC PowerPack]]></category>
		<category><![CDATA[XML File / SOAP API Driver]]></category>
		<category><![CDATA[ads]]></category>
		<category><![CDATA[AdWords]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[xml driver]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=8244</guid>

					<description><![CDATA[<p>Introduction In the previous article, we learned how to get data from AdWords in SSIS and basically control your AdWords account programmatically, outside the dashboard. In this one, we will continue on how to download AdWords report by using Google Ads API, ODBC, and ZappySys XML Driver. Let&#8217;s not waste our time and cut to [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/download-adwords-report-using-google-api-odbc-xml-driver/">Download AdWords report using Google Ads API, ODBC, and XML Driver</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/google-ads-connector/">API Connector for Google AdWords</a> which makes it much simpler to <strong>Read/Write Google AdWords Data in SSIS/ODBC</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).<br />
</div></div>
<p>In the previous article, we learned <a href="https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/" target="_blank" rel="noopener">how to get data from AdWords </a><a href="https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/" target="_blank" rel="noopener">in SSIS</a> and basically control your AdWords account programmatically, outside the dashboard. In this one, we will continue on how to download AdWords report by using Google Ads API, ODBC, and ZappySys XML Driver. Let&#8217;s not waste our time and cut to the chase!</p>
<h2>Prerequisites</h2>
<ol>
<li><a href="http://ads.google.com" target="_blank" rel="noopener">Google Ads</a> account up and running.</li>
<li><a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">ZappySys ODBC PowerPack</a> installed.</li>
</ol>
<h2>Step-by-Step &#8211; Download AdWords report</h2>
<h3>Get Developer Token</h3>
<p>The first important step to access any Google Ads Account is to request a developer token. <a href="https://developers.google.com/adwords/api/docs/guides/first-api-call" target="_blank" rel="noopener">Click this link</a> for step by step information. Watch a short video to get an overview of the entire process to access data via API.</p>
<h3>Get Client Customer Id</h3>
<p>Login into a <em><strong>non-manager</strong></em> account at <a href="https://ads.google.com" target="_blank" rel="noopener">https://ads.google.com</a> and get your Client Customer Id:</p>
<div id="attachment_8247" style="width: 594px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-clientCustomerId.png" rel="attachment wp-att-8247"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8247" class="wp-image-8247 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-clientCustomerId.png" alt="" width="584" height="341" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-clientCustomerId.png 584w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-clientCustomerId-300x175.png 300w" sizes="(max-width: 584px) 100vw, 584px" /></a><p id="caption-attachment-8247" class="wp-caption-text">Getting Google Ads (formerly AdWords) Client Customer Id</p></div>
<p>Copy it to a notepad, we will use it later.</p>
<h3>Open ODBC Data Sources Manager</h3>
<div class="content_block" id="custom_post_widget-8248">Search for "odbc" in your start menu and click on ODBC (64 bits). If you can't find this then you can also go to <span class="lang:default highlight:0 decode:true crayon-inline">Start Menu &gt; ZappySys &gt; ODBC PowerPack &gt; Click on ODBC Data Sources (64-Bit)</span>.
<div class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/03/odbc-data-source-64-bits.png">
<img decoding="async" src="https://zappysys.com/blog/wp-content/uploads/2018/03/odbc-data-source-64-bits.png" alt="Open ODBC Data Source" />
</a>
<p class="wp-caption-text">Open ODBC Data Source</p>

</div></div>
<h3>Create ODBC Data Source based on ZappySys XML Driver</h3>
<div class="content_block" id="custom_post_widget-8251">Select tab <em>User DSN</em> if you want to create a data source only for your user, or select System DSN to create a data source for all users or for OS services (e.g. SQL Server Agent):
<div class="wp-caption alignnone">
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-8252" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-create-xml-driver-based-dsn.png" alt="" width="657" height="486" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-create-xml-driver-based-dsn.png 657w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-create-xml-driver-based-dsn-300x222.png 300w" sizes="(max-width: 657px) 100vw, 657px" />
<p class="wp-caption-text">Creating ZappySys XML Driver based data source</p>
</div></div>
<h3>Configure authentication in the ODBC data source</h3>
<p>Let&#8217;s authenticate first:</p>
<ol>
<li>Select <strong>OAuth</strong> in <em>Connection Type</em> property.</li>
<li>Click <strong>Click to Configure</strong> link.</li>
<li>In <em>OAuth Provider</em> property select <strong>Google</strong>.</li>
<li>Then either select <strong>Use Default OAuth App</strong> or <strong>Use Custom OAuth App</strong>. For the latter, you will need to create a <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/#Step-By-Step_How_to_register_Google_OAuth_Application" target="_blank" rel="noopener">Google OAuth App yourself</a>. It&#8217;s perfectly safe to use the default application, but if your company policy does not allow it, you may consider creating it yourself.</li>
<li>In <em>Scopes</em> enter:<br />
<code>https://www.googleapis.com/auth/adwords</code></li>
<li>Then hit <strong>Generate Token</strong> and hit allow once asked.</li>
</ol>
<div id="attachment_8261" style="width: 666px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-oauth-configuration-getting-tokens.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8261" class="wp-image-8261 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-oauth-configuration-getting-tokens.png" alt="" width="656" height="745" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-oauth-configuration-getting-tokens.png 656w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-oauth-configuration-getting-tokens-264x300.png 264w" sizes="(max-width: 656px) 100vw, 656px" /></a><p id="caption-attachment-8261" class="wp-caption-text">Download AdWords report &#8211; Configuring authentication in ODBC data source</p></div>
<h3>Proceed with HTTP request configuration</h3>
<p>Then go on with configuring the data source:</p>
<div id="attachment_8260" style="width: 711px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-xml-data-source-configuration.png" rel="attachment wp-att-8260"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8260" class="wp-image-8260 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-xml-data-source-configuration.png" alt="" width="701" height="702" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-xml-data-source-configuration.png 701w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-xml-data-source-configuration-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-xml-data-source-configuration-300x300.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-8260" class="wp-caption-text">Configuring HTTP request in ODBC data source to download an AdWords report</p></div>
<ol>
<li>Give your data source a name</li>
<li>Then input this URL to download the report:<br />
<code>https://adwords.google.com/api/adwords/reportdownload/v201809</code><br />
If the above URL does not work, <a href="https://developers.google.com/adwords/api/docs/guides/reporting#http_request_url" target="_blank" rel="noopener">get the working one from Google&#8217;s documentation</a>.</li>
<li>Input <strong>POST</strong> as <em>HTTP Request Method</em>.</li>
<li>In Body enter this text:<br />
<code>__rdxml=&lt;reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201809"&gt;<br />
&lt;selector&gt;<br />
&lt;fields&gt;CampaignId&lt;/fields&gt;<br />
&lt;fields&gt;Impressions&lt;/fields&gt;<br />
&lt;fields&gt;Clicks&lt;/fields&gt;<br />
&lt;fields&gt;Cost&lt;/fields&gt;<br />
&lt;predicates&gt;<br />
&lt;field&gt;CampaignStatus&lt;/field&gt;<br />
&lt;operator&gt;IN&lt;/operator&gt;<br />
&lt;values&gt;ENABLED&lt;/values&gt;<br />
&lt;values&gt;PAUSED&lt;/values&gt;<br />
&lt;/predicates&gt;<br />
&lt;/selector&gt;<br />
&lt;reportName&gt;My Campaign Performance Report&lt;/reportName&gt;<br />
&lt;reportType&gt;CAMPAIGN_PERFORMANCE_REPORT&lt;/reportType&gt;<br />
&lt;dateRangeType&gt;LAST_7_DAYS&lt;/dateRangeType&gt;<br />
&lt;downloadFormat&gt;XML&lt;/downloadFormat&gt;<br />
&lt;/reportDefinition&gt;</code><br />
This will display the data of CAMPAIGN_PERFORMANCE_REPORT report (campaign Id, impressions, clicks, and cost) for the last 7 days, for all campaigns that are enabled or paused. Make sure to visit the <a href="https://developers.google.com/adwords/api/docs/guides/reporting#create_a_report_definition" target="_blank" rel="noopener">Google documentation page</a>, which contains the information about how to download a different kind of report, how to configure predicates, etc.</li>
<li>In <em>Body Content Type</em> property select <strong>Form (application/x-www-form-urlencoded) </strong>option.</li>
<li>In <em>HTTP Headers</em> enter your <strong>developerToken</strong> and <strong>clientCustomerId</strong> retrieved in previous steps.</li>
</ol>
<h3>Select data filter in ODBC data source</h3>
<p>Then hit <strong>Select Filter</strong> button and select <strong>row</strong> node, so that <em>Array Filter</em> is set to <strong>$.report.table.row[*]</strong></p>
<div id="attachment_8264" style="width: 662px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/download-adwords-report-using-google-api-odbc-xml-driver/download-adwords-report-using-google-api-and-odbc-the-filter/#main" rel="attachment wp-att-8264"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8264" class="wp-image-8264 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-filter.png" alt="" width="652" height="696" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-filter.png 652w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-filter-281x300.png 281w" sizes="(max-width: 652px) 100vw, 652px" /></a><p id="caption-attachment-8264" class="wp-caption-text">Filtering on AdWords report data</p></div>
<p>If asked whether you want to treat the <strong>row</strong> element as an array, click &#8220;yes&#8221;. You can also go to the <strong>Xml Array Handling</strong> tab and see if the element <strong>row</strong> is specified there.</p>
<h2>The Results</h2>
<p>To view the results press <strong>Preview</strong> tab and then click <strong>Preview Data</strong>:</p>
<div id="attachment_8266" style="width: 628px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-results-b.png" rel="attachment wp-att-8266"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8266" class="wp-image-8266 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-results-b.png" alt="" width="618" height="647" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-results-b.png 618w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-the-results-b-287x300.png 287w" sizes="(max-width: 618px) 100vw, 618px" /></a><p id="caption-attachment-8266" class="wp-caption-text">Previewing AdWords report data</p></div>
<p>Now you can use this data source and get the data into an <a href="https://zappysys.com/blog/import-json-excel-load-file-rest-api/#How_to_import_REST_API_data_to_Excel" target="_blank" rel="noopener">Excel sheet</a>, <a href="https://zappysys.com/blog/call-soap-api-power-bi-read-xml-web-service-data/#Import_XML_SOAP_Web_Service_in_Power_BI_Using_XML_Driver" target="_blank" rel="noopener">Power BI report</a>, <a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-gateway/" target="_blank" rel="noopener">SQL Server</a> (would need to create a data source in <a href="https://zappysys.com/products/odbc-powerpack/data-gateway/" target="_blank" rel="noopener">ZappySys Data Gateway</a> instead) or <a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-app-integration/" target="_blank" rel="noopener">elsewhere</a>.</p>
<h2>Reusing the data source</h2>
<p>If your client application supports, you can override data source settings, such as HTTP body, in SQL query using <strong>WITH</strong> clause. In that case, you won&#8217;t need to create multiple data sources for different kind of reports; e.g.:</p>
<p><code>SELECT * FROM $ (RequestData='@c:\files\report-definition.txt')</code></p>
<p><code>SELECT * FROM $ (RequestData='__rdxml=&lt;reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201809"&gt;<br />
&lt;selector&gt;<br />
&lt;fields&gt;CampaignId&lt;/fields&gt;<br />
&lt;fields&gt;Cost&lt;/fields&gt;<br />
&lt;/selector&gt;<br />
&lt;reportName&gt;My Campaign Performance Report&lt;/reportName&gt;<br />
&lt;reportType&gt;CAMPAIGN_PERFORMANCE_REPORT&lt;/reportType&gt;<br />
&lt;dateRangeType&gt;LAST_7_DAYS&lt;/dateRangeType&gt;<br />
&lt;downloadFormat&gt;XML&lt;/downloadFormat&gt;<br />
&lt;/reportDefinition&gt;')</code></p>
<p>Build a SQL query using the <strong>Query Builder</strong>:</p>
<div id="attachment_8267" style="width: 597px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8267" class="wp-image-8267 size-full" src="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-query-builder.png" alt="" width="587" height="373" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-query-builder.png 587w, https://zappysys.com/blog/wp-content/uploads/2019/10/download-adwords-report-using-google-api-and-odbc-query-builder-300x191.png 300w" sizes="(max-width: 587px) 100vw, 587px" /><p id="caption-attachment-8267" class="wp-caption-text">Use Query Builder to construct SQL query and override data source properties</p></div>
<h2>Conclusion</h2>
<p>In this article, we learned how to download AdWords report using ODBC PowerPack and Google API. We created an ODBC data source based on XML Driver, then configured the OAuth authentication, HTTP request and data filtering without a single line of code. Then we previewed AdWords &#8220;Campaign Performance Report&#8221; data and finally, considered how to reuse the data source we created. Visit <a href="https://zappysys.com/blog/category/odbc-powerpack/odbc-app-integration/" target="_blank" rel="noopener">https://zappysys.com/blog/category/odbc-powerpack/odbc-app-integration/</a> for examples of how to integrate data sources based on ZappySys Drivers into applications.</p>
<h2>References</h2>
<p><a href="https://developers.google.com/adwords/api/docs/guides/reporting" target="_blank" rel="noopener">https://developers.google.com/adwords/api/docs/guides/reporting</a></p>
<p><a href="https://developers.google.com/adwords/api/docs/appendix/reports" target="_blank" rel="noopener">https://developers.google.com/adwords/api/docs/appendix/reports</a></p>
<p><a href="https://developers.google.com/adwords/api/docs/appendix/reports/campaign-performance-report" target="_blank" rel="noopener">https://developers.google.com/adwords/api/docs/appendix/reports/campaign-performance-report</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/download-adwords-report-using-google-api-odbc-xml-driver/">Download AdWords report using Google Ads API, ODBC, and XML Driver</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read YouTube API data in SSIS (Videos, Channels, Playlists)</title>
		<link>https://zappysys.com/blog/read-youtube-api-data-ssis-videos-channels-playlists/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 06 May 2019 18:06:07 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS CSV Generator Transform]]></category>
		<category><![CDATA[SSIS JSON Parser Transform]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS OAuth Connection]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[youtube]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=6894</guid>

					<description><![CDATA[<p>Introduction In last few articles we saw how to read data from various Google Services. In this article we will see how to read YouTube API data in SSIS. This blog mainly focus on SSIS approach but steps mentioned to call Google APIs can be useful for any developer regardless which programming language or toolset [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/read-youtube-api-data-ssis-videos-channels-playlists/">How to read YouTube API data in SSIS (Videos, Channels, Playlists)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/youtube-connector/">API Connector for YouTube</a> which makes it much simpler to <strong>Read/Write YouTube Data in SSIS</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).</p>
</div></div>
<a href="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-logo.png"><img loading="lazy" decoding="async" class=" wp-image-6904 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-logo.png" alt="" width="100" height="100" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-logo.png 400w, https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-logo-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-logo-300x300.png 300w" sizes="(max-width: 100px) 100vw, 100px" /></a>In last <a href="https://zappysys.com/blog/category/google-api/">few articles</a> we saw how to read data from various Google Services. In this article we will see how to read YouTube API data in SSIS. This blog mainly focus on SSIS approach but steps mentioned to call Google APIs can be useful for any developer regardless which programming language or toolset you use.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2>Connect to YouTube API in SSIS (OAuth Connection)</h2>
<p>Very first step to call any Google API is to create an API project for Google Service and then enable APIs you like to call in Console. In our case we need to enable YouTube API.</p>
<p><a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">Check this article</a> to learn how to create API Project and obtain Client ID and Client Secret to connect to YouTube API. For ease of use use Default Application provided by ZappySys but we still recommend using your own Custom Application  on OAuth Connection.</p>
<p>Before we try our first YouTube API example, we recommend you to get familiar with <a href="https://developers.google.com/youtube/v3/docs/" target="_blank" rel="noopener">YouTube API here</a>. Once you done with above steps you can perform the following steps to call YouTube API in SSIS.</p>
<ol>
<li>Open existing SSIS Project or Create new One in Visual Studio (i.e. SSDT)</li>
<li>Create a new SSIS Package. Right click in the Connection Manager Panel and click <strong>&#8220;New Connection&#8230;&#8221;</strong>.<br />
<img decoding="async" class="figureimage" title="SSIS Create New Connection" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/ssis-new-connection.png" alt="SSIS Create New Connection" /></li>
<li>When Dialog box opens select <strong>ZS-OAUTH</strong> connection type.
<div id="attachment_4724" style="width: 681px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4724" class="size-full wp-image-4724" src="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager.png" alt="SSIS Connection Maangers List: Select O-AUTH Connection Manager" width="671" height="549" srcset="https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager.png 671w, https://zappysys.com/blog/wp-content/uploads/2018/08/ssis-connection-managers-list-select-zs-oauth-connection-manager-300x245.png 300w" sizes="(max-width: 671px) 100vw, 671px" /></a><p id="caption-attachment-4724" class="wp-caption-text">SSIS Connection Managers List: Select O-AUTH Connection Manager</p></div></li>
<li>Once OAuth UI opens, Configure Google connection like below.
<ol>
<li>Select Service Type as <strong>Google</strong></li>
<li>You can select Default App for ease of use or Select Custom Application (Enter Client Id and Secret Obtained using <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">these steps</a> )</li>
<li>In the Scope Enter below &#8211; One scope per line for calling correct YouTube API. Refer to <a href="https://developers.google.com/youtube/v3/docs/" target="_blank" rel="noopener">YouTube API documentation</a> incase you need extra permissions. For read only operation we just need below scopes. Last scope is only needed if you need to use <a href="https://developers.google.com/youtube/analytics/reference/reports/query" target="_blank" rel="noopener">YouTube Analytics Reports</a><br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtube.readonly
https://www.googleapis.com/auth/yt-analytics.readonly</pre>
</li>
</ol>
</li>
<li>Click Generate Token to obtain Refresh Token (You may see Login Prompt, and then Grant Permission Confirmation Screen)
<div id="attachment_6855" style="width: 930px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6855" class="size-full wp-image-6855" src="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token.png" alt="Connect to Google API using OAuth 2.0 (Youtube API Example)" width="920" height="1032" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token.png 920w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token-267x300.png 267w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token-768x861.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token-913x1024.png 913w" sizes="(max-width: 920px) 100vw, 920px" /></a><p id="caption-attachment-6855" class="wp-caption-text">Connect to Google API using OAuth 2.0 (YouTube API Example)</p></div></li>
<li>Click OK to save UI.</li>
</ol>
<h2>Call YouTube REST API Example</h2>
<p>Now lets look at how to call YouTube API <a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> this task is more suitable to call GET, POST, DELETE, PUT requests without parsing data in Rows and Columns. If you need to parse data and load into Database table then see next section (Use JSON Source)</p>
<ol>
<li>From SSIS Toolbox look for items starting with “ZS”. Drag and Drop <b>[ZS Rest API Task]</b> to Designer Surface.<br />
<img decoding="async" class="figureimage" title="SSIS REST Api Web Service Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="SSIS REST Api Task - Drag and Drop" /></li>
<li>Double click it to configure like below.
<ol>
<li>Select URL From Connection option</li>
<li>Select OAuth connection created in previous section.</li>
<li>Enter URL like below (For example <a href="https://developers.google.com/youtube/v3/docs/playlists/list" target="_blank" rel="noopener">get all playlists</a>). Replace xxxxxxxxxxx with your own channel ID (Its usually found in URL when you visit Youtube Channel Homepage)<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/playlists?part=snippet,id&amp;channelId=xxxxxxxxxxxxx</pre>
</li>
<li>Click Test Request Button</li>
</ol>
</li>
<li>Here is how it looks like
<div id="attachment_6896" style="width: 854px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-call-youtube-api-with-dynamic-url.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6896" class="size-full wp-image-6896" src="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-call-youtube-api-with-dynamic-url.png" alt="Call Youtube API in SSIS Example (Dynamic URL)" width="844" height="640" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-call-youtube-api-with-dynamic-url.png 844w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-call-youtube-api-with-dynamic-url-300x227.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-call-youtube-api-with-dynamic-url-768x582.png 768w" sizes="(max-width: 844px) 100vw, 844px" /></a><p id="caption-attachment-6896" class="wp-caption-text">Call Youtube API in SSIS Example (Dynamic URL)</p></div></li>
</ol>
<p>That&#8217;s it we have successfully configured Connection for YouTube API in SSIS. In the next section we will see how to use this connection and read various data from YouTube API.</p>
<h2>Read YouTube Playlists in SSIS</h2>
<p>Once we done creating OAuth Connection Manager we can move forward to read YouTube data inside Data Flow.</p>
<p>Configure SSIS JSON / REST API Source</p>
<ol>
<li>Now, Drag and Drop SSIS <b>Data Flow Task</b> from SSIS Toolbox.<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Double click on the Data Flow task to see Data Flow designer surface.</li>
<li>From the SSIS toolbox drag and drop JSON Source on the dataflow designer surface.<br />
<img decoding="async" class="figureimage" title="SSIS JSON Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-source/ssis-json-source-adapter-drag.png" alt="SSIS JSON Source - Drag and Drop" /></li>
<li>Double click JSON Source and enter URL as below (Use variable or Hardcode Channel Id). maxResults controls how many rows you want to get in each response. Rep<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/playlists?part=snippet,id&amp;maxResults=50&amp;channelId={{User::varChannelId}}
--OR-- 
https://www.googleapis.com/youtube/v3/playlists?part=snippet,id&amp;maxResults=50&amp;channelId=xxxxxxxxxxxxxxxxxxxxxx</pre>
</li>
<li>Check Use Credentials and select existing OAuth connection or Create New one</li>
<li>Select Array Filter (Items node) or type <pre class="crayon-plain-tag">$.items[*]</pre>  as below.
<div id="attachment_6900" style="width: 857px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-get-playlists.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6900" class="size-full wp-image-6900" src="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-get-playlists.png" alt="Get Playlists for YouTube Channel" width="847" height="738" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-get-playlists.png 847w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-get-playlists-300x261.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-get-playlists-768x669.png 768w" sizes="(max-width: 847px) 100vw, 847px" /></a><p id="caption-attachment-6900" class="wp-caption-text">Get Playlists for YouTube Channel</p></div></li>
<li>That&#8217;s it you can now Click <strong>Preview</strong> to see sample data. In the next section we will configure Pagination to read all records if you have more than 100 rows.</li>
</ol>
<h3>Configure YouTube REST API Pagination</h3>
<p>Most REST APIs dont return data in one big response. So you have to make sure you implement looping / pagination to read more records. Luckily ZappySys supports <a href="https://zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/">many different Pagination Settings</a>. Here is how to configure YouTube REST API Pagination.</p>
<ol>
<li>Go to Pagination Tab found on JSON Source and select following 3 settings</li>
<li>Select Pagination Mode as <pre class="crayon-plain-tag">Response Attribute Mode</pre></li>
<li>Enter Next Link as <pre class="crayon-plain-tag">$.nextPageToken</pre></li>
<li>Enter Suffix for Next URL as <pre class="crayon-plain-tag">&amp;pageToken=&lt;%nextlink%&gt;</pre></li>
</ol>
<div id="attachment_6899" style="width: 555px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-rest-api-pagination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6899" class="size-full wp-image-6899" src="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-rest-api-pagination.png" alt="YouTube REST API Pagination Settings" width="545" height="246" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-rest-api-pagination.png 545w, https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-rest-api-pagination-300x135.png 300w" sizes="(max-width: 545px) 100vw, 545px" /></a><p id="caption-attachment-6899" class="wp-caption-text">YouTube REST API Pagination Settings</p></div>
<h2>Read YouTube Playlist Videos in SSIS</h2>
<p>So in previous section we saw simple API call to read all playlists from YouTube. Now lets see how to get information about <a href="https://developers.google.com/youtube/v3/docs/playlistItems/list" target="_blank" rel="noopener">Playlist Videos</a>.</p>
<p>For that everything should remain same as previous section except change URL as below. Where xxxxxxxxxxxxxxxxxxxxx is your Playlist ID obtained from Previous Call.</p><pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/playlistItems?part=snippet,id&amp;maxResults=50&amp;playlistId=xxxxxxxxxxxxxxxxxxxxx</pre><p>
<h2>Get all Videos for YouTube Channel</h2>
<p>If you want to get all video name and ID for specific channel then use below URL. Click here to <a href="https://developers.google.com/youtube/v3/docs/search/list" target="_blank" rel="noopener">read more</a>. Replace xxxxxxxxxxxxxxxxxxx with your Channel ID.</p><pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/search?channelId=xxxxxxxxxxxxxxxxxxx&amp;part=snippet,id&amp;order=date&amp;maxResults=50</pre><p>
&nbsp;</p>
<h2>Read YouTube Video Views, Likes, Dislikes (Extended Videos)</h2>
<p>Another common request from YouTube API is get Video Information such as Views, Likes, Dislikes, Comment Count etc. For that you can <a href="https://developers.google.com/youtube/v3/docs/videos/list" target="_blank" rel="noopener">use this api</a> . However the issue is this endpoint requires you to pass Comma separated Ids of Video. You can only pass 25 Ids in one requests so if you have 200 videos for which you need to get information then you have to make 8 requests (25 Ids in each Request). In below screenshot you can see we used <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler to debug web requests</a>.</p>
<p>So here is how high level process to fetch extended information for all Videos in your channel. Full <a href="https://zappysys.com/blog/wp-content/uploads/2019/05/Google_Youtube_API_Demo.zip">SSIS Package is attached here (SSIS 2012 Format)</a>.</p>
<ol>
<li>Get all videos for your channel by calling (Assuming you will paginate in below request.<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/search?channelId=xxxxxxxxxxxxxxxxxxx&amp;part=snippet,id&amp;order=date&amp;maxResults=50</pre>
</li>
<li>Build Video Id groups for 25 Ids from above result and submit requests. For example if above request returns 200 Videos then your request to fetch extended information may look like below.<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&amp;id=ID1,ID2,ID3........ID25
https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&amp;id=ID26,ID27,ID28........ID50
........
........
https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,statistics&amp;id=ID176,ID177,ID178........ID200</pre>
</li>
<li>Parse response coming from each Request Above&#8230;. Each Response will give you details about 25 videos you requesting.</li>
</ol>
<p>Here is the flow of our complete data flow to read extended information for all videos. You can read extended information one by one too but it wont be good idea if you have many videos.</p>
<p>We have used Following Components to achieve Bulk Mode</p>
<ul>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source (REST API Source)</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-csv-parser-transform/" target="_blank" rel="noopener">CSV Parser Transform</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a></li>
</ul>
<div id="attachment_6901" style="width: 1306px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6901" class="size-full wp-image-6901" src="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes.png" alt="Get YouTube Video View Clicks, Likes, Dislikes (Bulk Mode for all videos)" width="1296" height="823" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes.png 1296w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes-300x191.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes-768x488.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-get-youtube-video-view-count-likes-dislikes-1024x650.png 1024w" sizes="(max-width: 1296px) 100vw, 1296px" /></a><p id="caption-attachment-6901" class="wp-caption-text">Get YouTube Video View Clicks, Likes, Dislikes (Bulk Mode for all videos)</p></div>
<h2>Read data from YouTube Analytics / Reporting API (Metrics, Dimensions Report)</h2>
<p>So far we have seen basic YouTube APIs to extract your Channel information. However there is another very powerful API endpoint to query custom reports from YouTube. Check <a href="https://developers.google.com/youtube/analytics/reference/reports/query" target="_blank" rel="noopener">this YouTube Analytics API endpoint</a>. In this section we will learn how to extract useful information from YouTube using Analytics API.</p>
<h3>Step-By-Step</h3>
<p>Let&#8217;s look at an example to read total views, estimated watch time, average view duration and some other metrics by date for channel you have access.</p>
<ol>
<li>Go to Data Flow, Drag ZS JSON Source from SSIS Toolbox</li>
<li>Double click to configure.</li>
<li>Check Use Credentials. Select OAuth connection we created in previous section.</li>
<li>In the URL field, Enter Below Sample URL. Change Parameters as per your need or leave it default.<br />
For example:<br />
<strong>ids=channel==MINE</strong>   (where MINE can be replaced by other channel id or keep it as MINE to get data for your own channel)<br />
<strong>metrics</strong> (can be changed from any <a href="https://developers.google.com/youtube/analytics/metrics" target="_blank" rel="noopener">valid list here</a>)<br />
<strong>dimensions</strong> (can be changed to any valid <a href="https://developers.google.com/youtube/analytics/dimensions" target="_blank" rel="noopener">list from here</a>)<br />
<strong>startDate</strong> (Must be YYYY-MM-DD format)<br />
<strong>endDate</strong> (Must be YYYY-MM-DD format)<br />
<pre class="crayon-plain-tag">https://youtubeanalytics.googleapis.com/v2/reports?ids=channel==MINE&amp;metrics=views,estimatedMinutesWatched,averageViewDuration,averageViewPercentage,subscribersGained&amp;dimensions=day&amp;startDate=2019-03-01&amp;endDate=2019-04-01</pre>
</li>
<li>Change Filter to <pre class="crayon-plain-tag">$.rows[*]</pre></li>
<li>Go to <strong>2D Array Transform</strong> tab.<br />
Select Method as <pre class="crayon-plain-tag">Simple 2-dimensional array</pre>
EnterColumn Filter as  <pre class="crayon-plain-tag">$.columnHeaders[*].name</pre>
<div id="attachment_6909" style="width: 906px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/advanced-transform-youtube-analytics-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6909" class="size-full wp-image-6909" src="https://zappysys.com/blog/wp-content/uploads/2019/05/advanced-transform-youtube-analytics-api.png" alt="YouTube Analytics API Advanced Transformation" width="896" height="270" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/advanced-transform-youtube-analytics-api.png 896w, https://zappysys.com/blog/wp-content/uploads/2019/05/advanced-transform-youtube-analytics-api-300x90.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/advanced-transform-youtube-analytics-api-768x231.png 768w" sizes="(max-width: 896px) 100vw, 896px" /></a><p id="caption-attachment-6909" class="wp-caption-text">YouTube Analytics API Advanced Transformation</p></div></li>
<li>That&#8217;s it now Preview your data. See below over all steps.
<div id="attachment_6910" style="width: 978px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-analytics-report-api-dimensions-metrics.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6910" class="size-full wp-image-6910" src="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-analytics-report-api-dimensions-metrics.png" alt="Read data from YouTube Analytics API (Custom Reports using Dimensions, Metrics Query)" width="968" height="741" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-analytics-report-api-dimensions-metrics.png 968w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-analytics-report-api-dimensions-metrics-300x230.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/ssis-youtube-analytics-report-api-dimensions-metrics-768x588.png 768w" sizes="(max-width: 968px) 100vw, 968px" /></a><p id="caption-attachment-6910" class="wp-caption-text">Read data from YouTube Analytics API (Custom Reports using Dimensions, Metrics Query)</p></div></li>
</ol>
<h3>Build YouTube Analytics / Reporting API Query (API Playground)</h3>
<p>With Analytics API You can extract many interesting data. You can use Test Tool found <a href="https://developers.google.com/youtube/analytics/reference/reports/query" target="_blank" rel="noopener">on this page to build</a> some interesting queries. Scroll to <strong>Common Use Cases</strong> section on that link. On the right side you can select Credentials Type as OAuth and click Execute.</p>
<p><a href="https://developers.google.com/youtube/analytics/reference/reports/query" target="_blank" rel="noopener">https://developers.google.com/youtube/analytics/reference/reports/query</a></p>
<div id="attachment_6911" style="width: 944px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-analytics-api-explorer-test-query-builder.jpg"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6911" class="size-full wp-image-6911" src="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-analytics-api-explorer-test-query-builder.jpg" alt="YouTube Analytics / Reporting API Explorer (Testing API Calls)" width="934" height="688" srcset="https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-analytics-api-explorer-test-query-builder.jpg 934w, https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-analytics-api-explorer-test-query-builder-300x221.jpg 300w, https://zappysys.com/blog/wp-content/uploads/2019/05/youtube-analytics-api-explorer-test-query-builder-768x566.jpg 768w" sizes="(max-width: 934px) 100vw, 934px" /></a><p id="caption-attachment-6911" class="wp-caption-text">YouTube Analytics / Reporting API Explorer (Testing API Calls)</p></div>
<h2>Loading YouTube API Data into SQL Server</h2>
<div class="content_block" id="custom_post_widget-5617"><p>ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other  targets. The <strong>Upsert Destination</strong> component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.</p>
<h3>Step 1: Add Upsert Destination to Data Flow</h3>
<ol>
<li>Drag and drop the <strong>Upsert Destination</strong> component from the SSIS Toolbox.</li>
<li>Connect your source component (e.g., JSON / REST / Other Source) to the Upsert Destination.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2017/08/ssis-data-flow-drag-drop-upsert-destination.png" /></a>
<p class="wp-caption-text">SSIS - Data Flow - Drang and Drop Upsert Destination Component</p>
</div>
<h3>Step 2: Configure Target Connection</h3>
<ol>
<li>Double-click the <strong>Upsert Destination</strong> component to open the configuration window.</li>
<li>Under <strong>Connection</strong>, select an existing target connection or click <strong>NEW</strong> to create a new connection.
<ul>
<li>Example: SQL Server, or PostgreSQL, or Amazon Redshift.</li>
</ul>
</li>
</ol>
<h3>Step 3: Select or Create Target Table</h3>
<ol>
<li>In the <strong>Target Table</strong> dropdown, select the table where you want to load data.</li>
<li>Optionally, click <strong>NEW</strong> to create a new table based on the source columns.</li>
</ol>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-configuration.png" /></a>
<p class="wp-caption-text">Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS</p>
</div>
<h3>Step 4: Map Columns</h3>
<ol>
<li>Go to the <strong>Mappings</strong> tab.</li>
<li>Click <strong>Auto Map</strong> to map source columns to target columns by name.</li>
<li>Ensure you <strong>check the Primary key column(s)</strong> that will determine whether a record is inserted or updated.</li>
<li>You can manually adjust the mappings if necessary.</li>
</ol>
 <div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2020/09/upsert-destination-key.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination - Columns Mappings</p>
</div>
<h3>Step 5: Save Settings</h3>
<ul>
<li>Click <strong>OK</strong> to save the Upsert Destination configuration.</li>
</ul>
<h3>Step 6: Optional: Add Logging or Analysis</h3>
<ul>
<li>You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.</li>
</ul>
<h3>Step 7: Execute the Package</h3>
<ul>
<li>Run your SSIS package and verify that the data is correctly inserted and updated in the target table.</li>
</ul>
<div class="wp-caption aligncenter">
<a href="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png">
<img loading="lazy" decoding="async" class="size-full" alt="" src="https://zappysys.com/blog/wp-content/uploads/2018/12/ssis-upsert-destination-execute.png" /></a>
<p class="wp-caption-text">SSIS Upsert Destination Execution</p>
</div></div>
<h2>Download Sample SSIS Package</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2019/05/Google_Youtube_API_Demo.zip">SSIS Package is attached here (SSIS 2012 Format)</a>.</p>
<h2>Conclusion</h2>
<p>In this article we saw how to extract information from REST API such as YouTube REST API using OAuth 2.0. We also learned techniques like Pagination, JSON Parsing, Request Batching using multiple components to achieve full scale API integration. To explore many other scenarios not discussed in this article download <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack from here (includes 70+ Components)</a>.</p>
<p>The post <a href="https://zappysys.com/blog/read-youtube-api-data-ssis-videos-channels-playlists/">How to read YouTube API data in SSIS (Videos, Channels, Playlists)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SSIS Geocoding with Google Maps API</title>
		<link>https://zappysys.com/blog/ssis-geocoding-with-google-maps-api/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 14 Sep 2018 14:02:23 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS Components]]></category>
		<category><![CDATA[SSIS JSON Parser Transform]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[geocoding]]></category>
		<category><![CDATA[geocoding api]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google maps api]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[reverse geocoding]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=4821</guid>

					<description><![CDATA[<p>Introduction In this tutorial, we will cover the topics of how to perform geocoding on the addresses and reverse geocoding on the location coordinates using SSIS and Google Maps API. So what is geocoding, exactly? Geocoding is the process of translating an address (e.g. a street address) or a place to coordinates on the Earth&#8217;s surface. Simply [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/ssis-geocoding-with-google-maps-api/">SSIS Geocoding with Google Maps API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><img loading="lazy" decoding="async" class="wp-image-4852 alignleft" src="https://zappysys.com/blog/wp-content/uploads/2018/09/icons8-google-maps-180-e1537353957364.png" alt="" width="100" height="100" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/icons8-google-maps-180-e1537353957364.png 155w, https://zappysys.com/blog/wp-content/uploads/2018/09/icons8-google-maps-180-e1537353957364-150x150.png 150w" sizes="(max-width: 100px) 100vw, 100px" /></p>
<p style="text-align: justify;">In this tutorial, we will cover the topics of how to perform <em>geocoding</em> on the addresses and <em>reverse geocoding</em> on the location coordinates using SSIS and <a href="https://developers.google.com/maps/documentation/" rel="noopener">Google Maps API</a>. So what is <em>geocoding,</em> exactly? <em>Geocoding</em> is the process of translating an address (e.g. a street address) or a place to coordinates on the Earth&#8217;s surface. Simply put, <em>geocoding</em> takes a description of a location and gives back latitude and longitude values as a result. For example, <pre class="crayon-plain-tag">1600 Amphitheatre Parkway, Mountain View, CA 94043, USA</pre>  gets translated to <pre class="crayon-plain-tag">(37.4224764, -122.0842499)</pre>. <em>Reverse geocoding</em>, on the other hand, is the exact opposite process. In it, latitude and longitude values pair gets translated into a human-readable form. To take the same example above,  <pre class="crayon-plain-tag">(37.4224764, -122.0842499)</pre> would translate back to <pre class="crayon-plain-tag">1600 Amphitheatre Parkway, Mountain View, CA 94043, USA</pre>. So, if you need to perform any of the lookups, you can use <a href="https://developers.google.com/maps/documentation/geocoding/start" rel="noopener">Google Maps Geocoding API</a>. Actually, Google Maps Geocoding API offers a bit more <span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– you can use it for <em>address validation</em>, <em>cleansing</em>, and <em>formatting</em>.</span></span></span></span></p>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE:</strong> If it happens that you need to use other geocoding provider and perform the lookups in SSIS, you may still benefit from this article (the examples of usage of Google Maps Geocoding API can be replaced by another provider). </div></div>
<p style="text-align: justify;">To accomplish our goal we will use an add-on for SSIS <span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– <a href="https://zappysys.com/products/ssis-powerpack/" rel="noopener">ZappySys SSIS PowerPack</a></span></span></span></span><span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">.</span></span></span></span> It contains many additional SSIS Tasks and Data Flow Components that lets you accomplish what you cannot do with standard SSIS connectors. We will use these <a href="https://zappysys.com/products/ssis-powerpack/" rel="noopener">ZappySys SSIS PowerPack</a> connectors:</p>
<div class="content_block" id="custom_post_widget-5067"><div style="display: table-row; background: #f7f7f7;">
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc;"><img loading="lazy" decoding="async" style="vertical-align: middle; width: 50px; height: 50px; max-width: 50px;" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/web-api-destination/ssis-web-api-destination.png" alt="Web API Destination" width="50" height="50" /></div>
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc; border-left: none; width: 100%;"><a href="//zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></div>
</div></div>
<div class="content_block" id="custom_post_widget-5078"><div style="display: table-row; background: #f7f7f7;">
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc;"><img loading="lazy" decoding="async" style="vertical-align: middle; width: 50px; height: 50px; max-width: 50px;" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-parser-transform/ssis-json-parser-transform.png" alt="JSON Parser Transform" width="50" height="50" /></div>
<div style="display: table-cell; padding: 1em; border: 1px solid #ccc; border-left: none; width: 100%;"><a href="//zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">JSON Parser Transform</a></div>
</div></div>
<p>Let&#8217;s start!</p>
<div class="content_block" id="custom_post_widget-2523"><h2><span id="Prerequisites">Prerequisites</span></h2>
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:
<ol style="margin-left: 1.5em;">
 	<li><abbr title="SQL Server Integration Services">SSIS</abbr> designer installed. Sometimes it is referred to as <abbr title="Business Intelligence Development Studio">BIDS</abbr> or <abbr title="SQL Server Data Tools">SSDT</abbr> (<a href="https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt" target="_blank" rel="noopener">download it from the Microsoft site</a>).</li>
 	<li>Basic knowledge of SSIS package development using <em>Microsoft SQL Server Integration Services</em>.</li>
 	<li>Make sure <span style="text-decoration: underline;"><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">ZappySys SSIS PowerPack</a></span> is installed (<a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">download it</a>, if you haven't already).</li>
 	<li>(<em>Optional step</em>)<em>.</em> <a href="https://zappysys.zendesk.com/hc/en-us/articles/360035974593" target="_blank" rel="noopener">Read this article</a>, if you are planning to deploy packages to a server and schedule their execution later.</li>
</ol></div>
<h2><span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS">Step-by-Step <span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– </span></span></span></span>SSIS Geocoding with Google Maps API</h2>
<p style="text-align: justify;">Before we start, let&#8217;s consider the use-case for our tutorial. Suppose, you have a CRM system filled with user-entered addresses of your leads. Since they are user-entered, it means that they can be incomplete, malformed, or just plain rubbish. Also, you have a marketing campaign and you want to send letters with offers to your leads so that they become your clients. Before sending them any letters, you have to make sure the addresses are valid and well-formed. You are also interested in the geographical location of your leads that you could do some business intelligence analysis on the coordinates of your leads and maybe future clientele. Here is where Geocoding API kicks in.</p>
<p style="text-align: justify;">Thus in this example, we will take various street addresses <span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– sometimes invalid, </span></span></span></span>incomplete or unformatted <span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– and submit them to Google Geocoding API for processing. </span></span></span></span><span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">As a result, we will get nicely formatted, cleansed, full addresses and their coordinates. We will take a look on how to determine if lookup worked successfully and to what extent you should trust Geocoding API&#8217;s response. Finally, we will save retrieved addresses and their individual components (e.g. street number, street name, city, country, etc.) to a SQL Server database table.</span></span></span></span></p>
<div class="content_block" id="custom_post_widget-5017"><h3>Create a Google project</h3>
First, to use a Google API, you need to have a Google project. Create one, if you don't have any or want to use a new project:
<ol>
 	<li>Go to <a href="https://console.cloud.google.com/home/dashboard" target="_blank" rel="noopener">Google Console</a> and click on the projects list:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4923" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list.png" alt="" width="603" height="243" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list.png 603w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list-300x121.png 300w" sizes="(max-width: 603px) 100vw, 603px" /></li>
 	<li>Once a window opens, click "New Project":
<img loading="lazy" decoding="async" class="alignnone wp-image-4924 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-create-new-project-1-e1538487942630.png" alt="" width="731" height="258" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-create-new-project-1-e1538487942630.png 731w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-create-new-project-1-e1538487942630-300x106.png 300w" sizes="(max-width: 731px) 100vw, 731px" /></li>
 	<li>Give a name for the project and click "Create":
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4925" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-give-name-for-project.png" alt="" width="603" height="379" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-give-name-for-project.png 603w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-give-name-for-project-300x189.png 300w" sizes="(max-width: 603px) 100vw, 603px" /></li>
 	<li>Wait a couple of minutes for the project to create.</li>
 	<li>Again, click on the projects drop-down list:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4926" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list-1.png" alt="" width="603" height="243" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list-1.png 603w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-project-list-1-300x121.png 300w" sizes="(max-width: 603px) 100vw, 603px" /></li>
 	<li>Finally, select the project you've just created:
<img loading="lazy" decoding="async" class="alignnone wp-image-4927 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-the-project-e1538487850139.png" alt="" width="721" height="355" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-the-project-e1538487850139.png 721w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-the-project-e1538487850139-300x148.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-the-project-e1538487850139-720x355.png 720w" sizes="(max-width: 721px) 100vw, 721px" /></li>
</ol></div>
<div class="content_block" id="custom_post_widget-5025"><h3>Enable billing for the project</h3>
Not all Google APIs are free. So you'll have to add billing for the project you have just created:
<div class="su-note" style="border-color: #e5dea5; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;">
<div class="su-note-inner su-clearfix" style="background-color: #fff7b7; border-color: #fffdf1; color: #333333; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;"><strong>NOTE</strong>: As of September 21, 2018, Google offers 300 USD credit for free (but you will still need to create a billing account).</div>
</div>
<ol>
 	<li>Visit <a href="https://console.cloud.google.com/project/_/billing/enable?redirect=https://developers.google.com/maps/documentation/geocoding/usage-and-billing?dialogOnLoad%3Dbilling-enabled" target="_blank" rel="noopener">Billing on Google Console</a> page.</li>
 	<li>Once it's opened, select the project:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4928" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-project-list.png" alt="" width="641" height="385" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-project-list.png 641w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-project-list-300x180.png 300w" sizes="(max-width: 641px) 100vw, 641px" /></li>
 	<li>Once a list of projects appears, select the one you created.</li>
 	<li>Then you will be prompted to create a billing account. Proceed to create one:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4929" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-create-account.png" alt="" width="514" height="202" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-create-account.png 514w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-billing-create-account-300x118.png 300w" sizes="(max-width: 514px) 100vw, 514px" /></li>
</ol></div>
<div class="content_block" id="custom_post_widget-5031"><h3>Enable Google API for your project</h3>
To use any Google API you must enable it for your project:
<ol>
 	<li>Visit <a href="https://console.cloud.google.com/apis" target="_blank" rel="noopener">Google APIs Dashboard</a> page.</li>
 	<li>Make sure your project is selected and then click "Enable APIs and services":
<img loading="lazy" decoding="async" class="alignnone wp-image-4931 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-enable-api-for-the-project-e1538488797230.png" alt="" width="718" height="272" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-enable-api-for-the-project-e1538488797230.png 718w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-enable-api-for-the-project-e1538488797230-300x114.png 300w" sizes="(max-width: 718px) 100vw, 718px" /></li>
 	<li>Then in the box which appears, search for API you are interested in, e.g. "geocoding":
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4934" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-search-for-api-1.png" alt="" width="645" height="303" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-search-for-api-1.png 645w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-search-for-api-1-300x141.png 300w" sizes="(max-width: 645px) 100vw, 645px" /></li>
 	<li>Finally, click on the Google API (e.g. "Geocoding API") tile:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4935" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-geocoding-api.png" alt="" width="654" height="405" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-geocoding-api.png 654w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-select-geocoding-api-300x186.png 300w" sizes="(max-width: 654px) 100vw, 654px" /></li>
 	<li>Finally finally, enable Google API:
<img loading="lazy" decoding="async" class="alignnone wp-image-4936 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-enable-geocoding-api-e1537539131256.png" alt="" width="647" height="343" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-enable-geocoding-api-e1537539131256.png 647w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-api-console-enable-geocoding-api-e1537539131256-300x159.png 300w" sizes="(max-width: 647px) 100vw, 647px" /></li>
</ol></div>
<div class="content_block" id="custom_post_widget-5035"><h3>Create Geocoding API Key</h3>
Once you have Google API enabled, you are ready to create a Google API Key, which you will use in all HTTP requests:
<ol>
 	<li>Go to <a href="https://console.cloud.google.com/apis/dashboard" target="_blank" rel="noopener">Google APIs Dashboard</a>.</li>
 	<li>Make sure you have your project selected, then select "Credentials" menu item and create a new API Key:
<img loading="lazy" decoding="async" class="alignnone size-full wp-image-4937" src="https://zappysys.com/blog/wp-content/uploads/2018/09/sssi-google-api-how-to-create-api-key.png" alt="" width="695" height="434" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/sssi-google-api-how-to-create-api-key.png 695w, https://zappysys.com/blog/wp-content/uploads/2018/09/sssi-google-api-how-to-create-api-key-300x187.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/09/sssi-google-api-how-to-create-api-key-436x272.png 436w" sizes="(max-width: 695px) 100vw, 695px" /></li>
 	<li>Copy the newly created API Key to a safe place; we will use it later.</li>
</ol></div>
<h3>Load addresses from a SQL Server database table</h3>
<p>We prepared the Google Geocoding API part, now we are ready to get to the place where the rubber meets the road <span id="Step-by-Step_Export_data_from_Salesforce_to_SQL_Server_using_SSIS"><span id="Step-by-Step_Get_data_from_HubSpot_API_into_SQL_Server_database"><span id="Step-By-StepGet_data_from_HubSpot_REST_API"><span id="Step-By-Step_8211_Call_Amazon_MWS_API_using_SSIS">– </span></span></span></span>we will create an SSIS package and load addresses from a database table:</p>
<ol>
<li>Create a new SSIS package.</li>
<li>Drag and drop <strong>Data Flow</strong> from SSIS Toolbox onto the Control Flow.
<div id="attachment_8028" style="width: 470px" class="wp-caption alignnone"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8028" class="size-full wp-image-8028" src="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png" alt="" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2019/02/drag-and-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /><p id="caption-attachment-8028" class="wp-caption-text">Dragging and dropping Data Flow Task into Control Flow</p></div></li>
<li>Drag and drop <strong>OLE DB Source</strong> onto the Data Flow.</li>
<li>Configure <strong>OLE DB Source</strong> to retrieve addresses from your table. We will use a table from Microsoft&#8217;s Northwind&#8217;s modified database &#8220;Marketing&#8221; (<a href="https://zappysys.com/blog/wp-content/uploads/2018/09/Marketing-database-script.zip">download it</a>):</li>
</ol>
<div id="attachment_4949" style="width: 718px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-load-addresses-1-e1538134305642.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4949" class="wp-image-4949 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-load-addresses-1-e1538134305642.png" alt="Loading user-entered addresses to be looked up in Google Geocoding API using SSIS." width="708" height="704" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-load-addresses-1-e1538134305642.png 708w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-load-addresses-1-e1538134305642-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-load-addresses-1-e1538134305642-300x298.png 300w" sizes="(max-width: 708px) 100vw, 708px" /></a><p id="caption-attachment-4949" class="wp-caption-text">Loading user-entered addresses to be looked up in Google Geocoding API using SSIS.</p></div>
<h3>Construct lookup URL</h3>
<ol>
<li>Drag and drop <strong>Derived Column</strong> component onto the Data Flow.</li>
<li>Add a new column and construct Geocoding lookup URL in this format (just like it says in <a href="https://developers.google.com/maps/documentation/geocoding/start" rel="noopener">Geocoding API documentation</a>):</li>
</ol>
<pre class="crayon-plain-tag">https://maps.googleapis.com/maps/api/geocode/json?address=ADDRESS_TO_LOOKUP&amp;key=YOUR_API_KEY</pre>
<div id="attachment_4959" style="width: 729px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-construct-url-e1538140223385.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4959" class="wp-image-4959 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-construct-url-e1538140223385.png" alt="Adding Google Geocoding API lookup URL as Derived Column to be used for geocoding in SSIS." width="719" height="510" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-construct-url-e1538140223385.png 719w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-construct-url-e1538140223385-300x213.png 300w" sizes="(max-width: 719px) 100vw, 719px" /></a><p id="caption-attachment-4959" class="wp-caption-text">Adding Google Geocoding API lookup URL as Derived Column to be used for geocoding in SSIS.</p></div>
<h3>Configure the Geocoding API request</h3>
<ol>
<li>Drag and drop <strong>Web API Destination</strong> onto the Data Flow and connect it with Derived Column. We will use Web API Destination to make HTTP requests to Geocoding API.</li>
<li>Then double-click on Web API Destination and create a new HTTP connection:
<div id="attachment_4962" style="width: 796px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-create-http-connection.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4962" class="wp-image-4962 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-create-http-connection.png" alt="Setting up HTTP Connection Manager for Web API Destination to make HTTP requests to Google Geocoding API using SSIS." width="786" height="478" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-create-http-connection.png 786w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-create-http-connection-300x182.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-create-http-connection-768x467.png 768w" sizes="(max-width: 786px) 100vw, 786px" /></a><p id="caption-attachment-4962" class="wp-caption-text">Setting up HTTP Connection Manager for Web API Destination to make HTTP requests to Google Geocoding API using SSIS.</p></div></li>
<li>Finally, configure <em>Input Column for URL</em>, <em>HTTP Request Method</em> and input into URL field a sample lookup URL:<br />
<pre class="crayon-plain-tag">https://maps.googleapis.com/maps/api/geocode/json?address=One Microsoft Way Redmond 98052-6399 USA&amp;key=YOUR_API_KEY</pre>
<div id="attachment_4963" style="width: 711px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-web-api-destination.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4963" class="wp-image-4963 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-web-api-destination.png" alt="Configuring Web API Destination to make geocoding lookups in Google Geocoding API using SSIS." width="701" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-web-api-destination.png 701w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-web-api-destination-300x267.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></a><p id="caption-attachment-4963" class="wp-caption-text">Configuring Web API Destination to make geocoding lookups in Google Geocoding API using SSIS.</p></div>
<p>Once you are done, click <strong>Test Request/Response</strong> button. This will actually make a geocoding lookup for Microsoft headquarters:</li>
<li>In the <em>Response (Raw)</em> tab you see the actual response from Geocoding API. Within it –  cleansed, formatted and full Microsoft headquarters address together with geographical coordinates (even we looked it up using just the part of it). Now copy-paste the response body somewhere, so that we can use it in the next step while parsing:
<div id="attachment_4964" style="width: 693px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-sample-response.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4964" class="wp-image-4964 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-sample-response.png" alt="Checking Google Geocoding API HTTP response in Web API Destination using SSIS." width="683" height="642" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-sample-response.png 683w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-sample-response-300x282.png 300w" sizes="(max-width: 683px) 100vw, 683px" /></a><p id="caption-attachment-4964" class="wp-caption-text">Checking Google Geocoding API HTTP response in Web API Destination using SSIS.</p></div></li>
</ol>
<div class="su-note"  style="border-color:#e5da9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#fff4b7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE:</strong> When Google Geocoding API retrieves only a partial result, it adds a new property in JSON named <em>partial_match</em>, as described in <a href="https://developers.google.com/maps/documentation/geocoding/intro#Results" rel="noopener">Geocoding API documentation</a>. This node is not present in the above sample response. </div></div>
<h3>Parsing Geocoding API JSON response into columns</h3>
<ol>
<li>Drag and drop <strong>JSON Parser Transform</strong> onto the Data Flow and connect it to Web API Destination.</li>
<li>Then open it and configure <em>Input JSON Column</em>.</li>
<li>After that, set the <em>Filter</em> to <strong>$.results[*]</strong>.</li>
<li>Continue by setting <em>Sample JSON strin</em>g to the one you saved in the previous step. Actually, before doing that let&#8217;s modify it and add <strong>partial_match</strong> node next to <strong>place_id</strong> so that <em>exact</em> and <em>partial</em> matches could be told apart (otherwise this property won&#8217;t be parsed):<br />
<pre class="crayon-plain-tag">{
    "results": [{
        "address_components": [{
            "long_name": "One",
            "short_name": "One",
            "types": ["street_number"]
        }, {
            "long_name": "Microsoft Way",
            "short_name": "Microsoft Way",
            "types": ["route"]
        }, {
            "long_name": "Overlake",
            "short_name": "Overlake",
            "types": ["neighborhood", "political"]
        }, {
            "long_name": "Redmond",
            "short_name": "Redmond",
            "types": ["locality", "political"]
        }, {
            "long_name": "King County",
            "short_name": "King County",
            "types": ["administrative_area_level_2", "political"]
        }, {
            "long_name": "Washington",
            "short_name": "WA",
            "types": ["administrative_area_level_1", "political"]
        }, {
            "long_name": "United States",
            "short_name": "US",
            "types": ["country", "political"]
        }, {
            "long_name": "98052",
            "short_name": "98052",
            "types": ["postal_code"]
        }],
        "formatted_address": "One Microsoft Way, Redmond, WA 98052, USA",
        "geometry": {
            "location": {
                "lat": 47.6423318,
                "lng": -122.1369302
            },
            "location_type": "ROOFTOP",
            "viewport": {
                "northeast": {
                    "lat": 47.6436807802915,
                    "lng": -122.1355812197085
                },
                "southwest": {
                    "lat": 47.6409828197085,
                    "lng": -122.1382791802915
                }
            }
        },
        "partial_match": false,
        "place_id": "ChIJGxUEuHFtkFQRnokD7mkppQE",
        "plus_code": {
            "compound_code": "JVR7+W6 Redmond, Washington, United States",
            "global_code": "84VVJVR7+W6"
        },
        "types": ["establishment", "point_of_interest"]
    }],
    "status": "OK"
}</pre>
<div id="attachment_4967" style="width: 729px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-json-parser-transform-1.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4967" class="wp-image-4967 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-json-parser-transform-1.png" alt="Configuring JSON Parser Transform to parse looked up addresses in Google Geocoding API HTTP JSON response using SSIS." width="719" height="584" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-json-parser-transform-1.png 719w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-json-parser-transform-1-300x244.png 300w" sizes="(max-width: 719px) 100vw, 719px" /></a><p id="caption-attachment-4967" class="wp-caption-text">Configuring JSON Parser Transform to parse looked up addresses in Google Geocoding API HTTP JSON response using SSIS.</p></div></li>
<li>To proceed and parse <em>individual address components</em> from JSON response (e.g. number, street, city, country, etc.), you will need to specify columns for each address component manually, just like portrayed in <a href="https://zappysys.com/blog/parse-multi-dimensional-json-array-ssis/#Pattern_5_8211_Multiple_Columns_with_Expressions_Google_Geocoding_API_Usecase" rel="noopener">Parse multi-dimensional JSON array in SSIS or Drivers</a> article. Just open <em>2D Array Transform</em> tab and select <strong>Multiple columns using expressions</strong> as <em>Transform Type</em> and configure them:
<div id="attachment_4970" style="width: 716px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-columns-json-parser-transform-1.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4970" class="wp-image-4970 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-columns-json-parser-transform-1.png" alt="Configuring JSON Parser Transform to parse individual address components from Google Geocoding API HTTP JSON response using SSIS." width="706" height="739" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-columns-json-parser-transform-1.png 706w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-configure-columns-json-parser-transform-1-287x300.png 287w" sizes="(max-width: 706px) 100vw, 706px" /></a><p id="caption-attachment-4970" class="wp-caption-text">Configuring JSON Parser Transform to parse individual address components from Google Geocoding API HTTP JSON response using SSIS.</p></div>
<p>We specify these columns in our example:</p><pre class="crayon-plain-tag">Number = $.address_components[?(@.types[0]=='street_number')].long_name
Street = $.address_components[?(@.types[0]=='route')].long_name
City = $.address_components[?(@.types[0]=='locality')].long_name
State = $.address_components[?(@.types[0]=='administrative_area_level_1')].long_name
Country = $.address_components[?(@.types[0]=='country')].long_name
PostalCode = $.address_components[?(@.types[0]=='postal_code')].long_name</pre><p>
</li>
<li>Finally, be sure to set <strong>Include all upstream columns to downstream</strong> (quite important), so that CustomerID is passed downstream and which we can save into a destination table. Later it can be a useful column to join the source table and the destination table on. In that way, you will be able to map user-entered addresses with looked up, fully formatted addresses (won&#8217;t be demonstrated in this tutorial).</li>
</ol>
<h3>Save geocoding results into a SQL Server database table</h3>
<ol>
<li>We are now ready to add <strong>OLE DB Destination</strong>, execute the package, make the lookups, and save the results into the database:
<div id="attachment_4971" style="width: 828px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-saving-results-into-ole-db-destination-e1538150325533.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4971" class="wp-image-4971 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-saving-results-into-ole-db-destination-e1538150325533.png" alt="Creating a database table for the Google Geocoding API looked up addresses in SSIS." width="818" height="727" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-saving-results-into-ole-db-destination-e1538150325533.png 818w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-saving-results-into-ole-db-destination-e1538150325533-300x267.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-saving-results-into-ole-db-destination-e1538150325533-768x683.png 768w" sizes="(max-width: 818px) 100vw, 818px" /></a><p id="caption-attachment-4971" class="wp-caption-text">Creating a database table for the Google Geocoding API looked up addresses in SSIS.</p></div></li>
<li>Execute the package!
<div id="attachment_4972" style="width: 705px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-lookup-results.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4972" class="wp-image-4972 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-lookup-results.png" alt="SSIS geocoding package execution and its results." width="695" height="471" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-lookup-results.png 695w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-lookup-results-300x203.png 300w" sizes="(max-width: 695px) 100vw, 695px" /></a><p id="caption-attachment-4972" class="wp-caption-text">SSIS geocoding package execution and its results.</p></div></li>
</ol>
<h3>The results of SSIS geocoding</h3>
<div id="attachment_4985" style="width: 614px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4985" class="wp-image-4985 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis.png" alt="Viewing the results of SSIS geocoding in SQL Server destination table." width="604" height="209" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis.png 604w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis-300x104.png 300w" sizes="(max-width: 604px) 100vw, 604px" /></a><p id="caption-attachment-4985" class="wp-caption-text">Viewing the results of SSIS geocoding in SQL Server destination table.</p></div>
<p style="text-align: justify;">Once you query the table of looked up results, you will notice several things:</p>
<ol style="text-align: justify;">
<li>Perhaps there are more rows in the results table than in the source table</li>
<li><em>partial_match</em> column is either <strong>1</strong> or <strong>NULL</strong></li>
<li><em>geometry.location_type </em>column has several values, e.g. <strong>ROOFTOP</strong>, <strong>RANGE_INTERPOLATED</strong>, <strong>APPROXIMATE</strong>, etc.</li>
</ol>
<p style="text-align: justify;">So to what extent should you trust the results? The answer is to take a look at <a href="https://developers.google.com/maps/documentation/geocoding/intro#Results" rel="noopener">the documentation</a> and see what these values mean.</p>
<p style="text-align: justify;">Basically, when <em>partial_match</em> is equal to <strong>1</strong>, according to Google:</p>
<ul style="text-align: justify;">
<li>Partial matches most often occur for street addresses that do not exist within the locality you pass in the request.</li>
<li>Partial matches may also be returned when a request matches two or more locations in the same locality. For example, &#8220;21 Henr St, Bristol, UK&#8221; will return a partial match for both Henry Street and Henrietta Street. Note that if a request includes a misspelled address component, the geocoding service may suggest an alternative address. Suggestions triggered in this way will also be marked as a partial match.</li>
</ul>
<p style="text-align: justify;">While <em>geometry.location_type</em> column tells how accurate the lookup was. Again, according to Google:</p>
<ul style="text-align: justify;">
<li><strong>&#8220;ROOFTOP&#8221;</strong> indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision.</li>
<li><strong>&#8220;RANGE_INTERPOLATED&#8221;</strong> indicates that the returned result reflects an approximation (usually on a road) interpolated between two precise points (such as intersections). Interpolated results are generally returned when rooftop geocodes are unavailable for a street address.</li>
<li><strong>&#8220;GEOMETRIC_CENTER&#8221;</strong> indicates that the returned result is the geometric center of a result such as a polyline (for example, a street) or polygon (region).</li>
<li><strong>&#8220;APPROXIMATE&#8221;</strong> indicates that the returned result is approximate.</li>
</ul>
<p style="text-align: justify;">Simply put, <strong>&#8220;ROOFTOP&#8221;</strong> is the most accurate lookup, while <strong>&#8220;APPROXIMATE&#8221;</strong> is the least accurate.</p>
<p style="text-align: justify;">Another valuable piece of information is how many individual address components are filled. The more <strong>NULLs</strong> are there, the less accurate is the address. So if you have <strong>NULL</strong> in the <em>Number</em> column and in the <em>Street</em> column, most likely this is not a very accurate lookup:</p>
<div id="attachment_4987" style="width: 675px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis2.png" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4987" class="wp-image-4987 size-full" src="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis2.png" alt="Individual address components of looked up addresses in Google Geocoding API using SSIS." width="665" height="210" srcset="https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis2.png 665w, https://zappysys.com/blog/wp-content/uploads/2018/09/ssis-google-geocoding-api-result-analysis2-300x95.png 300w" sizes="(max-width: 665px) 100vw, 665px" /></a><p id="caption-attachment-4987" class="wp-caption-text">Individual address components of looked up addresses in Google Geocoding API using SSIS.</p></div>
<p style="text-align: justify;">Concluding, in the figure above, you can see how user-entered address can be <em>validated</em>, <em>cleansed</em> and <em>formatted</em>.</p>
<h2>SSIS reverse geocoding with Google Maps API</h2>
<p>The concepts presented above about &#8220;forward&#8221; geocoding will help you to make reverse geocoding requests too. The only difference is the request URL:</p><pre class="crayon-plain-tag">https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&amp;key=YOUR_API_KEY</pre><p>
For reference and help visit official <a href="https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding" rel="noopener">Google Geocoding API documentation</a>.</p>
<div class="content_block" id="custom_post_widget-2021"><h2>Things have gone bad: Error handling &amp; debugging</h2>
<p style="text-align: justify;">Incidentally, bad things can happen<i>. </i>A remote server may go offline or your server may go out of memory. In any case, you may want to know when that happens and take actions accordingly. For that purpose, you have to redirect bad rows to some other destination. For this example, we will take and use <em>Web API Destination</em>, but basically, you can use any SSIS component:</p>

<h3>Handling errors</h3>
<ol style="margin-left: 0;">
 	<li>Add a <em>Derived Column</em> above <em>Web API Destination</em> with expression <strong>"(DT_WSTR,4000)ZS_JSON_OUT"</strong> and name it <strong>"JsonAsString"</strong>. This will let you see what JSON you are actually passing.</li>
 	<li>Then add a database or file destination or use another <em>Trash Destination</em> for debugging purposes and redirect the bad rows (<span style="color: #d66565;">red arrow</span>) from <em><em>Web API Destination </em></em>into it<em><em>. </em></em>Don't forget to set <span class="lang:default decode:true crayon-inline">Redirect row</span> option for both, <em>Error</em> and <em>Truncation</em> columns:<em><em>
</em></em>
<div class="wp-caption">

<a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1487 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png" alt="Redirect bad rows from &lt;em&gt;Web API Destination&lt;/em&gt; to &lt;em&gt;Trash Destination&lt;/em&gt; when load from SQL Server to Elasticsearch is failing. Add derived column JsonAsString to be able to read JSON you are using." width="739" height="267" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows.png 739w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-redirecting-bad-rows-300x108.png 300w" sizes="(max-width: 739px) 100vw, 739px" /></a>
<p class="wp-caption-text">Redirected failed requests from <em>Web API Destination</em> to a desired destination when loading from SQL Server to REST API Service is failing. Derived Column <em>JsonAsString</em> added to be able to read JSON which was passed to Elasticsearch</p>

</div></li>
 	<li>Finally, add a <a href="https://technet.microsoft.com/en-us/library/ms140318%28v=sql.90%29.aspx?f=255&amp;MSPPError=-2147217396" target="_blank" rel="noopener"><em>Data Viewer</em></a> for the red path, if you want to debug the flow. You will be able to see URL, JSON and the error message for each record. You may want to copy-paste <em>ErrorMessage</em> to <em>Notepad </em>if you want it to be more readable:
<div class="wp-caption">

<a href="//zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-1494 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png" alt="Use Data Viewer to view HTTP requests that failed to be fulfilled in Elasticsearch" width="752" height="280" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling.png 752w, https://zappysys.com/blog/wp-content/uploads/2017/06/ssis-sql-server-to-elasticsearch-error-handling-300x112.png 300w" sizes="(max-width: 752px) 100vw, 752px" /></a>
<p class="wp-caption-text">Use Data Viewer to view HTTP requests that failed to be fulfilled.</p>

</div></li>
</ol>
<div class="su-note" style="border-color: #e5dea5; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;">
<div class="su-note-inner su-clearfix" style="background-color: #fff7b7; border-color: #fffdf1; color: #333333; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;"><strong>NOTE</strong>: You can read more about redirecting rows in <a href="//zappysys.com/blog/ssis-error-handling-in-data-flow-redirect-bad-rows/" target="_blank" rel="noopener">SSIS Error Handling (Redirect bad rows)</a> article.</div>
</div>
<h3>Debugging HTTP requests</h3>
<p style="text-align: justify;">A common thing you have to do when working with HTTP requests is to debug those requests; e.g. to check what headers, body or URL was passed. <span id="Debug_Web_API_call_using_Fiddler"></span>To test how things look behind the scenes we strongly suggest to use <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler</a> - a popular web debugging tool.</p>
<p style="text-align: justify;">Inside it, you can double-click the URL entry (Right side) to see Request and Response Panels. The top panel is Request (URL, Headers, Body) and Bottom Panel is Response. For https:// (secure URL) make sure you enable HTTPS option in Fiddler (Tools &gt; Options &gt; HTTPS &gt; Check Decrypt https request):</p>

<div id="attachment_2344" class="wp-caption alignnone">

<a href="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?ssl=1" target="_blank" rel="noopener"><img loading="lazy" decoding="async" class="alignnone wp-image-2344 size-full" style="border: 0px; max-width: 100%; height: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 1px 2px;" src="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png" alt="Debugging Web API call using Fiddler in SSIS" width="1287" height="564" data-attachment-id="2344" data-permalink="https://zappysys.com/blog/pass-authorization-header-redirected-location/ssis-rest-api-call-debug-via-fiddler/#main" data-orig-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=1287%2C564&amp;ssl=1" data-orig-size="1287,564" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="ssis-rest-api-call-debug-via-fiddler" data-image-description="&lt;p&gt;Debugging Web API call using Fiddler in SSIS&lt;/p&gt; " data-medium-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=300%2C131&amp;ssl=1" data-large-file="https://i1.wp.com/zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png?fit=720%2C316&amp;ssl=1" srcset="https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler.png 1287w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-300x131.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-768x337.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/05/ssis-rest-api-call-debug-via-fiddler-1024x449.png 1024w" sizes="(max-width: 1287px) 100vw, 1287px" /></a>
<p class="wp-caption-text">Debugging Web API call using Fiddler in SSIS</p>

</div></div>
<h2>Common errors</h2>
<div class="content_block" id="custom_post_widget-1887"><h3>Truncation related error</h3>
<p style="text-align: justify;">The most common error you may face when you run an SSIS package is truncation error. During the design time only 300 rows are scanned from a source (a file or a REST API call response) to detect datatypes but at runtime, it is likely you will retrieve far more records. So it is possible that you will get longer strings than initially expected. For detailed instructions on how to fix common metadata related errors read an article "<a href="//zappysys.com/blog/handling-ssis-component-metadata-issues/" target="_blank" rel="noopener">How to handle SSIS errors (truncation, metadata issues)</a>".</p>

<h3>Authentication related error</h3>
Another frequent error you may get is an authentication error, which happens when you deploy/copy a package to another machine and run it there. Check <a href="#Deployment_to_Production">the paragraph below</a> to see why it happens and how to solve this problem.</div>
<h2><span id="Deployment_to_Production">Parameterization and d</span><span id="Deployment_to_Production">eployment to production </span></h2>
<div class="content_block" id="custom_post_widget-1932"><p style="text-align: justify;">In SSIS package <a href="https://docs.microsoft.com/en-us/sql/integration-services/security/access-control-for-sensitive-data-in-packages" target="_blank" rel="noopener">sensitive data such as tokens and passwords are by default encrypted by SSIS</a> with your Windows account which you use to create a package. So SSIS will fail to decrypt tokens/passwords when you run it from another machine using another Windows account. To circumvent this when you are creating an SSIS package which uses authentication components (e.g. an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> or an <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-http-connection-manager.htm" target="_blank" rel="noopener">HTTP Connection Manager</a> with credentials, etc.), consider using parameters/variables to pass tokens/passwords. In this way, you won’t face authentication related errors when a package is deployed to a production server.</p>
<p style="text-align: justify;">Check our article on <a href="https://zappysys.com/blog/how-to-run-an-ssis-package-with-sensitive-data-on-sql-server/" target="_blank" rel="noopener">how to configure packages with sensitive data on your production or development server</a>.</p></div>
<h2>Download a sample package</h2>
<p style="text-align: justify;">Be sure to download a <a href="https://zappysys.com/blog/wp-content/uploads/2018/09/SSIS-Geocoding-using-Google-Maps-API.zip">sample SQL Server 2012 SSIS package</a>, in case you want to try it right away (you can upgrade it to a higher version). If you want to use the database that was used in this tutorial, don&#8217;t forget to create the <a href="https://zappysys.com/blog/wp-content/uploads/2018/09/Marketing-database-script.zip">Marketing database from the script</a> (a modified Microsoft&#8217;s Northwind database).</p>
<h2>Conclusion</h2>
<p style="text-align: justify;">In this tutorial, we step-by-step covered how to make geocoding lookups using Geocoding API, part of Google Maps API. We learned how to <em>cleanse</em>, <em>validate</em> and <em>format</em> address just by submitting it to Geocoding API and parsing the results. We moved forward and looked at how to interpret the results and what geocoding results to trust. Then we touched the point that the same process could be applied to <a href="https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding" rel="noopener"><em>reverse geocoding</em></a>. Concluding, we took a look at how to handle common errors and how to parameterize an SSIS package and deploy it to production.</p>
<p>The post <a href="https://zappysys.com/blog/ssis-geocoding-with-google-maps-api/">SSIS Geocoding with Google Maps API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read / write Google SpreadSheet using SSIS</title>
		<link>https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 24 Sep 2016 23:21:11 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[Google Drive]]></category>
		<category><![CDATA[Google Spreadsheet]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth2]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=798</guid>

					<description><![CDATA[<p>Introduction In this post you will learn how to get data from Google SpreadSheet (REST API) using SSIS. We will use drag and drop REST API connectors from SSIS PowerPack. No need to download any SDK or learn programming language (e.g. JAVA, C#, Ruby, Python) when you use SSIS PowerPack Connectors. We will use Google [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/">How to read / write Google SpreadSheet using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/google-sheets-connector/">API Connector for Google Sheets Online</a> which makes it much simpler to <strong>Read/Write Google Sheets Data in SSIS</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).</p>
</div></div>
<a href="//zappysys.com/blog/wp-content/uploads/2016/09/google-sheets-api-integration.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1670" src="//zappysys.com/blog/wp-content/uploads/2016/09/google-sheets-api-integration.png" alt="" width="150" height="171" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/google-sheets-api-integration.png 350w, https://zappysys.com/blog/wp-content/uploads/2016/09/google-sheets-api-integration-263x300.png 263w" sizes="(max-width: 150px) 100vw, 150px" /></a>In this post you will learn how to <em>get data from Google SpreadSheet</em> (REST API) using SSIS. We will use drag and drop REST API connectors from <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a>. No need to download any SDK or learn programming language (e.g. JAVA, C#, Ruby, Python) when you use SSIS PowerPack Connectors. We will use Google Drive API and Google Sheets API to get file list and export SpreadSheet as CSV file in few clicks (Using OAuth 2.0 connection in SSIS).</p>
<p>In this tutorial we will use <a href="//zappysys.com/blog/call-rest-api-using-ssis-web-service-task/" target="_blank" rel="noopener">REST API Task</a> to call some ad-hoc API (e.g. get File List from Google Drive) and save output into Variable or File. We will use <a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth connection</a> along with <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZappySys JSON Source connector</a> to read data from Google SpreadSheet (Use Drive API) and load into SQL Server (Export Google SpreadSheet to CSV).</p>
<h2>Create Google API Project</h2>
<p>First step to access any Google API is create an API Project in Google Console. If you don&#8217;t want to go through this then Skip this Step-1 and in the next section select Default OAuth App option on OAth Connection Manager (This is the most easiest option for now unless you want to use your own OAuth App).</p>
<p><a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">Check this article</a> for step-by-step instructions. When you follow these instructions make sure you enable Google Drive API (In the article it shows how to enable YouTube API as an example but you will need to enable Drive API for this article).</p>
<h2>Create OAuth Connection Manager in SSIS</h2>
<p>Once you create Google API project and obtained Client ID and Client Secret your next step is to create <a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">OAuth Connection Manager</a> in SSIS. ZappySys OAuth connection manager comes with many predefined OAuth Providers (e.g. Facebook, Twitter, Google etc) but you can also define custom OAuth settings for any OAuth enabled API.</p>
<p>To create SSIS OAuth 2.0 Connection for Google API perform following steps.</p>
<ol>
<li>Download and Install SSIS PowerPack</li>
<li>Create new SSIS Package</li>
<li>Right click in Connection Manager Area and Click &#8220;New Connection&#8221;</li>
<li>When prompted select ZS-OAUTH connection type</li>
<li>On the OAuth Connection Manager Select Provider=<strong>Google Sheets + Drive</strong>.</li>
<li>You can keep &#8220;Use Default App&#8221; selected or choose Custom App. <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">Click here to learn &#8211; how to register Custom Google App</a></li>
<li>If you choose the Custom App option then <strong>enter the below scopes</strong> (or click Select Scopes). If you choose the default app then it&#8217;s not required.
<p>This will allow read / write access to Drive Files or Sheet (E.g. Reading file content / Export file to CSV). You can use Scope browser to see many other available permissions.</p><pre class="crayon-plain-tag">https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/spreadsheets.readonly</pre><p>
Click Generate Token button.</p>
<div id="attachment_847" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-oauth-connection-google-drive-api-access-file.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-847" class="wp-image-847" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-oauth-connection-google-drive-api-access-file.png" alt="SSIS OAuth Connection Manager - Access Google Drive API using OAuth 2.0" width="600" height="351" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-oauth-connection-google-drive-api-access-file.png 957w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-oauth-connection-google-drive-api-access-file-300x176.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-847" class="wp-caption-text">SSIS OAuth Connection Manager &#8211; Access Google Drive API using OAuth 2.0</p></div></li>
<li>You will see UI as below&#8230; Click Accept (You may have to scroll to see that button sometimes)</li>
<li>Click Test to see connection is working.</li>
</ol>
<p><strong>NOTE:</strong> If you don&#8217;t want to use Default OAuth App provided by ZappySys then select &#8220;Use Custom OAuth App&#8221; option (App created in previous section) specify your ClientID, ClientSecret.</p>
<h2>Find Google Sheet ID for API call</h2>
<p>Before we can read or write Sheet data in SSIS we need to know Google Driver File ID. We will use this ID in next few sections.</p>
<p>Easiest way to find File ID is look at the URL like below. If you need to know ID at runtime dynamically then refer last section.</p>
<p>&nbsp;</p>
<div id="attachment_8450" style="width: 806px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8450" class="size-full wp-image-8450" src="https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call.png" alt="Get Google Drive File ID for API call (Sheet ID)" width="796" height="286" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call.png 796w, https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call-300x108.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/obtain-google-sheet-id-for-api-call-768x276.png 768w" sizes="(max-width: 796px) 100vw, 796px" /></a><p id="caption-attachment-8450" class="wp-caption-text">Get Google Drive File ID for API call (Sheet ID)</p></div>
<h2>Reading Google SpreadSheet Data in SSIS</h2>
<p>Basically there are two ways you can export / read Google SpreadSheet data.</p>
<ul>
<li>Method-1 : Read Google SpreadSheet using SSIS JSON / REST API Source
<ul>
<li>In this approach we directly pull data from SpreadSheet using <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get" target="_blank" rel="noopener">Core Google SpreadSheet.Values API</a> to read particular Tab from Sheet and you can also specify Range. This is most effective way to read. Make sure you have <strong>v2.5.0.10807 or higher version</strong> (released after Aug 03 2017). New version added <a href="//zappysys.com/blog/parse-multi-dimensional-json-array-ssis/" target="_blank" rel="noopener">2D array transformation options to parse multi-dimensional arrays</a> found in SpreadSheet API JSON response.</li>
</ul>
</li>
<li>Method-2 : Read Google SpreadSheet using Flat File Source (as CSV)
<ul>
<li>Another approach is export SpreadSheet as CSV format. Then use Flat File Source to read that data and load into Target (E.g. SQL Server)</li>
</ul>
</li>
</ul>
<h3>Method-1 : Read Google SpreadSheet using SSIS JSON / REST API Source</h3>
<p>Now lets look at real steps to read Google SpreadSheet. To get values from specific tab and specific cell-row range you have to use <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get" target="_blank" rel="noopener">Google SpreadSheet.Values API</a></p>
<p>In this example we will load below Google Spreadsheet into SQL Server</p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-reading-google-spreadsheet-example.png"><img loading="lazy" decoding="async" class="alignnone wp-image-1657" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-reading-google-spreadsheet-example.png" alt="" width="521" height="327" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-reading-google-spreadsheet-example.png 777w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-reading-google-spreadsheet-example-300x188.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-reading-google-spreadsheet-example-768x482.png 768w" sizes="(max-width: 521px) 100vw, 521px" /></a></p>
<h4><strong>Step-By-Step : Loading Google SpreadSheet into SQL Server using SSIS</strong></h4>
<ol>
<li>Drag and drop data flow on the control flow designer surface</li>
<li>Double click data flow and you will see SSIS Toolbox refreshed with new components</li>
<li>Drag ZS JSON Source from SSIS Toolbox onto Data flow designer surface</li>
<li>Double click JSON SOurce and configure below setting
<ol>
<li>Enter your Spreadsheet URL in the following format<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{your-file-id}/values/{cell-range}</pre>
For example purpose we will use <a href="https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit#gid=0" target="_blank" rel="noopener">this public SpreadSheet provided by Google</a>. If spreadsheet fileid is <strong>1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms</strong> (see previous section how to get fileid) and your tab name is <strong>Class Data</strong> and you like to extract data from <strong>A to F</strong> columns <strong>starting from 2nd row</strong> then your Cell range in the URL can be <strong>&#8216;Class Data&#8217;!A2:F</strong><br />
Here is the actual URL we will use for demo<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/values/'Class Data'!A2:F</pre>
&#8212; OR &#8212;<br />
You can also enter like below (If you omit Tab name then first table is used)<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/values/A1:F

--OR-- Use below URL for to supply Column names manually (Start from A2)

https://sheets.googleapis.com/v4/spreadsheets/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/values/A2:F</pre>
You can also enter like below, specify first row and last row<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/values/A1:F101</pre>
</li>
<li>Check Use credentials and select OAuth connection we created in previous section</li>
<li>Click on Select Filter and select values node and click OK  or you can directly enter following filter.<br />
<pre class="crayon-plain-tag">$.values[*]</pre>
<div id="attachment_1652" style="width: 894px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1652" class="size-full wp-image-1652" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api.png" alt="Configure SSIS JSON/REST API Source - Read data from Google SpreadSheet API " width="884" height="673" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api.png 884w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-300x228.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-768x585.png 768w" sizes="(max-width: 884px) 100vw, 884px" /></a><p id="caption-attachment-1652" class="wp-caption-text">Configure SSIS JSON/REST API Source &#8211; Read data from Google SpreadSheet API</p></div></li>
<li>Now click on array Transformation tab. Now we will show you two different ways to configure column names.</li>
<li><strong>Method-1: Auto Detect Column Names</strong> (added in <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/release-notes.htm" target="_blank" rel="noopener">version 3.1.2</a>)<br />
In recent version we added column less array transformation where we have option to detect first record as column name.</p>
<ol>
<li>Select Transform Type as Column less array</li>
<li>Check option First line has column names like below example (Ignore direct Sample JSON &#8211; We provided for demo only. In your case it will be URL)
<div id="attachment_9118" style="width: 645px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9118" class="wp-image-9118 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern.png" alt="JSON With 2D Array Pattern - Column names in First Row (Google Sheets API Pattern)" width="635" height="669" srcset="https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern.png 635w, https://zappysys.com/blog/wp-content/uploads/2017/08/columnless-array-first-line-has-names-pattern-285x300.png 285w" sizes="(max-width: 635px) 100vw, 635px" /></a><p id="caption-attachment-9118" class="wp-caption-text">JSON With 2D Array Pattern &#8211; Column names in First Row (Google Sheets API Pattern)</p></div></li>
</ol>
</li>
<li><strong>Method-2: Manually Enter Column Names</strong> (For old version)
<ol>
<li>Select Transform simple 2D array option from dropdown</li>
<li>Check Specify columns list manually</li>
<li>Enter column names (Must match the order and count based on range you selected)<br />
<pre class="crayon-plain-tag">Student Name,Gender,Class Level,Home State,Major,Extracurricular Activity</pre>
<div id="attachment_1653" style="width: 878px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1653" class="size-full wp-image-1653" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-2.png" alt="Configure SSIS JSON/REST API Source 2D Array Transformation for Google SpreadSheet API " width="868" height="255" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-2.png 868w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-2-300x88.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-2-768x226.png 768w" sizes="(max-width: 868px) 100vw, 868px" /></a><p id="caption-attachment-1653" class="wp-caption-text">Configure SSIS JSON/REST API Source 2D Array Transformation for Google SpreadSheet API</p></div></li>
</ol>
</li>
<li>Now click Preview to see the data
<div id="attachment_1654" style="width: 872px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-3.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1654" class="size-full wp-image-1654" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-3.png" alt="Configure SSIS JSON/REST API Source - Preview Google SpreadSheet Data" width="862" height="678" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-3.png 862w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-3-300x236.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-json-source-read-google-spreadsheet-data-rest-api-3-768x604.png 768w" sizes="(max-width: 862px) 100vw, 862px" /></a><p id="caption-attachment-1654" class="wp-caption-text">Configure SSIS JSON/REST API Source &#8211;<br />Preview Google SpreadSheet Data</p></div></li>
<li>Click OK to save UI</li>
<li>Attach your JSON Source to target (e.g. OLEDB Destination for SQL Server Table).</li>
<li>Configure Destination
<div id="attachment_1655" style="width: 825px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-google-spreadsheet-to-sql-server-load.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1655" class="size-full wp-image-1655" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-google-spreadsheet-to-sql-server-load.png" alt="Configure SQL Server destination for Google SpreadSheet to SQL Data load" width="815" height="489" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-google-spreadsheet-to-sql-server-load.png 815w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-google-spreadsheet-to-sql-server-load-300x180.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-configure-google-spreadsheet-to-sql-server-load-768x461.png 768w" sizes="(max-width: 815px) 100vw, 815px" /></a><p id="caption-attachment-1655" class="wp-caption-text">Configure SQL Server destination for Google SpreadSheet to SQL Data load</p></div></li>
<li>Execute SSIS Package to load Google SpreadSheet data int SQL Server
<div id="attachment_1656" style="width: 628px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-loading-google-spreadsheet-to-sql-server-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1656" class="size-full wp-image-1656" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-loading-google-spreadsheet-to-sql-server-example.png" alt="SSIS Example -Loading data from Google SpreadSheet into SQL Server Table" width="618" height="311" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-loading-google-spreadsheet-to-sql-server-example.png 618w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-loading-google-spreadsheet-to-sql-server-example-300x151.png 300w" sizes="(max-width: 618px) 100vw, 618px" /></a><p id="caption-attachment-1656" class="wp-caption-text">SSIS Example -Loading data from Google SpreadSheet into SQL Server Table</p></div></li>
</ol>
</li>
</ol>
<h3>Method-2 : Read Google SpreadSheet using Flat File Source (as CSV)</h3>
<p>Once we have Google Drive fileId we can perform following actions to export data into CSV file format. After that you can easily read CSV using SSIS FlatFile Source and load into SQL Server or other target.</p>
<h4>Export Google SpreadSheet as CSV file using SSIS REST API Task</h4>
<p>Here are the steps to export Google Drive SpreadSheet to CSV file</p>
<ol>
<li>Just like previous section configure REST API Task</li>
<li>Enter following URL (See we used FileId from SSIS variable. You can hardcode too.<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/drive/v3/files/{{User::varFileId}}/export?mimeType=text/csv</pre>
</li>
<li>Goto response tab. Check Save response and select &#8220;Save to file option&#8221;.</li>
<li>Enter file path.</li>
<li>Response character set select utf-8 (This will allow Unicode characters in response)</li>
<li>Click Test to see preview
<div id="attachment_850" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-export-google-spreadsheet-to-csv-format-call-google-drive-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-850" class="wp-image-850" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-export-google-spreadsheet-to-csv-format-call-google-drive-api.png" alt="Export Google SpreadSheet to CSV file format using SSIS - Call Google Drive API to Export" width="600" height="503" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-export-google-spreadsheet-to-csv-format-call-google-drive-api.png 701w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-export-google-spreadsheet-to-csv-format-call-google-drive-api-300x252.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-850" class="wp-caption-text">Export Google SpreadSheet to CSV file format using SSIS &#8211; Call Google Drive API to Export</p></div></li>
<li>Click OK to save</li>
</ol>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">NOTE: New version now includes CSV Source for API. Use that if you want to consume Google Spread Sheet data in Data Flow. However we still recommend JSON Source (As per previous section to read data. Use CSV export method only if JSON API is not working for you for some reason.</div></div>
<h4>Load Google SpreadSheet data into SQL Server using SSIS (REST API Call)</h4>
<p>Once you export SpreadSheet to CSV file you can easily consume it to load into SQL Server or any Target (e.g. Oracle, MySQL) using Native SSIS FlatFile Source and OLEDB/ADO.net Destination.</p>
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>NOTE:</strong> Using FlatFile Source is not covered in Article. You can find many articles online which shows how to use SSIS FlatFile Source.</div></div>
<h2>Write data to Google Spread Sheet</h2>
<p>Now lets look at how to write to Google SpreadSheet. To write multiple rows in a single request you may use <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/batchUpdate" target="_blank" rel="noopener">batchUpdate API</a>. Also check this link to <a href="https://developers.google.com/sheets/api/guides/values" target="_blank" rel="noopener">learn more</a>.</p>
<p>Below is sample request to write data to columns and some data to rows (set majorDimension = <strong>COLUMNS</strong> to <strong>write vertical</strong> and use <strong>ROWS</strong> to <strong>write horizontally</strong>. You can mix multiple ways just like below example)</p><pre class="crayon-plain-tag">POST 
https://sheets.googleapis.com/v4/spreadsheets/1lkMEgu0zm2Q-cnPeoNZp4hqeIuASxXSpsrxtDDV89tg/values:batchUpdate
Authorization: Bearer ya29.Gl3WBFb3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
Accept: */*

{
  "valueInputOption": "USER_ENTERED",
  "data": [
    {
      "range": "Sheet2!A1:A4",
      "majorDimension": "COLUMNS",
      "values": [
        ["Item", "Wheel", "Door", "Engine"]
      ]
    },
    {
      "range": "Sheet2!B1:D2",
      "majorDimension": "ROWS",
      "values": [
        ["Cost", "Stocked", "Ship Date"],
        ["$20.50", "4", "3/1/2016"]
      ]
    }
  ]
}</pre><p>
<div id="attachment_2050" style="width: 1282px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2050" class="size-full wp-image-2050" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth.png" alt="Write data to Google SpreadSheet using REST API Task (OAuth 2.0 Connection)" width="1272" height="668" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth.png 1272w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth-300x158.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth-768x403.png 768w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-write-google-spreadsheet-using-rest-api-oauth-1024x538.png 1024w" sizes="(max-width: 1272px) 100vw, 1272px" /></a><p id="caption-attachment-2050" class="wp-caption-text">Write data to Google SpreadSheet using REST API Task (OAuth 2.0 Connection)</p></div>
<p>&nbsp;</p>
<h2>Update Google Sheet Cells &#8211; Single Range (Set Values for multiple cells)</h2>
<p>Now let&#8217;s look at the below example of updating multiple cells in google Sheet. For more information, you can see the <a href="https://developers.google.com/sheets/api/samples/writing" target="_blank" rel="noopener">example here</a>. For parameter detail review this API documentation.</p>
<p>You can use<a href="https://zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener"> SSIS REST API Task</a> or <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a> to achieve Spread Sheet Update scenario. For simple example lets use REST API Task.</p>
<ol>
<li>Drag and Drop ZS REST API Task on the control flow designer</li>
<li>Edit Task and select URL from Connection Method</li>
<li>Select OAuth Connection from the dropdown (Same connection we created in the previous section)</li>
<li>Enter the URL as below. Change Sheet ID, Range designator and API URL Parameters as per your need.<br />
<em>https://sheets.googleapis.com/v4/spreadsheets/<strong>[Sheet-ID-Here]</strong>/values/<strong>[Range-Here]</strong></em>?[<em><strong>Parameters-Here]
</strong></em><strong>Example URL (some part masked with xxxxxxxx):  </strong><br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6xxxxxxxxCHrORJc/values/Sheet1!A2:B4?valueInputOption=USER_ENTERED</pre>
</li>
<li>Change Request Method to <strong>PUT</strong></li>
<li>Change Request Content type to <strong>application/json</strong></li>
<li>Enter Request Body as below (Assuming we need to update 4 cells)<br />
<pre class="crayon-plain-tag">{
"majorDimension": "ROWS",
  "values": [
   ["row1_cellA","row1_cellB"],
   ["row2_cellA","row2_cellB"],
  ]
}</pre>
</li>
<li>Click Test Request see it works.
<div id="attachment_4521" style="width: 947px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-update-google-sheet-using-rest-api-multiple-cells.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4521" class="size-full wp-image-4521" src="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-update-google-sheet-using-rest-api-multiple-cells.png" alt="Calling Google Sheet API to Update Multiple Cell Values" width="937" height="948" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-update-google-sheet-using-rest-api-multiple-cells.png 937w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-update-google-sheet-using-rest-api-multiple-cells-297x300.png 297w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-update-google-sheet-using-rest-api-multiple-cells-768x777.png 768w" sizes="(max-width: 937px) 100vw, 937px" /></a><p id="caption-attachment-4521" class="wp-caption-text">Calling Google Sheet API to Update Multiple Cell Values</p></div></li>
</ol>
<h2>Update Google Sheet Cells &#8211; Multiple Ranges</h2>
<p>If you like to update values which needs to define multiple ranges then you need to use <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate" target="_blank" rel="noopener">batchUpdate API</a>. Import changes are you can&#8217;t include Range in the URL like previous example of Single Range Update. Also you have to use POST method and body with multiple ranges.</p>
<p>Example of sheet update with multiple range</p><pre class="crayon-plain-tag">POST https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHxxxxxxxxxxxxxxxc/values:batchUpdate?valueInputOption=USER_ENTERED
Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
  "data": [
    {
      "range": "Sheet1!A2:B3",
      "majorDimension": "ROWS",
      "values": [
        [
          "row1_cellA",
          "row1_cellB"
        ],
        [
          "row2_cellA",
          "row2_cellB"
        ]
      ]
    },
    {
      "range": "Sheet1!D2:E3",
      "majorDimension": "ROWS",
      "values": [
        [
          "row1_cellD",
          "row1_cellE"
        ],
        [
          "row2_cellD",
          "row2_cellE"
        ]
      ]
    }
  ]
}</pre><p>
&nbsp;</p>
<h2>Write SQL Server data to Google Sheet</h2>
<p>Now let&#8217;s look at real world example. How to write data from SQL Server table or other source and send to Google Sheet.</p>
<ol>
<li>Drag and Drop SSIS Data Flow Task from SSIS Toolbox<br />
<img decoding="async" class="figureimage" title="SSIS Data Flow Task - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/drag-and-drop-data-flow-task.png" alt="SSIS Data Flow Task - Drag and Drop" /></li>
<li>Drag source (e.g. OLEDB Source) and configure it to read from source like SQL Server Table
<div id="attachment_7289" style="width: 515px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/06/oledb-source-drag-and-drop.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-7289" class="size-full wp-image-7289" src="https://zappysys.com/blog/wp-content/uploads/2019/06/oledb-source-drag-and-drop.png" alt="OLE DB Source - Drag and Drop" width="505" height="190" srcset="https://zappysys.com/blog/wp-content/uploads/2019/06/oledb-source-drag-and-drop.png 505w, https://zappysys.com/blog/wp-content/uploads/2019/06/oledb-source-drag-and-drop-300x113.png 300w" sizes="(max-width: 505px) 100vw, 505px" /></a><p id="caption-attachment-7289" class="wp-caption-text">OLE DB Source &#8211; Drag and Drop</p></div></li>
<li>Drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/">ZS JSON Generator</a>.
<ol>
<li>Connect Source to JSON Generator (blue arrow)</li>
<li>Double click it to configure</li>
<li>Select Output Mode as <strong>Single Dataset Array</strong> option for Mode. Enter Some Batch value (e.g. 500) this will make sure we send 500 rows at a time to Google API call. This way if we have many rows its not rejected by API call.</li>
<li>Click <strong>Add element</strong> (Select <strong>Static Element</strong>) . Name: <strong>majorDimension</strong> and Value: <strong>ROWS</strong></li>
<li>Now click Add Document Array icon, name as <strong>values</strong></li>
<li>check Treat as <strong>2D array</strong> option and click OK to save</li>
<li>Now under values node click <strong>Add elements</strong> &gt; Select <strong>Multiple Columns</strong> and Add columns you like to add.</li>
<li>Click OK to save JSON GeneratorBelow is just an example How you can use Batch Settings to create JSON with N rows in each JSON document.<br />
<img decoding="async" src="https://i2.wp.com/zappysys.com/blog/wp-content/uploads/2019/02/ssis-generate-json-with-batch-setting.png?resize=720%2C564&amp;ssl=1" alt="Using SSIS JSON Generator Transform with Batch Option (Multiple Records in a single document)" /></li>
</ol>
</li>
<li>Now drag <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">ZS Web API destination</a>
<ol>
<li>Connect JSON Generator to Web API destination (blue arrow)</li>
<li>Double click it to configure</li>
<li>Select same OAuth connection manager created in earlier section (Assuming you had all scopes with write permission)</li>
<li>Now select <strong>Input column</strong> for <strong>Body </strong>(JSON Generator Output)</li>
<li>Enter API call URL as below (Replace <strong>ID</strong> with your own id)<br />
<pre class="crayon-plain-tag">https://sheets.googleapis.com/v4/spreadsheets/{your-file-id}/values/Sheet1!A2?valueInputOption=USER_ENTERED</pre>
</li>
<li>Select Request Method as <strong>PUT</strong></li>
<li>Select content type as <strong>application/json</strong></li>
<li>You can enter sample Body As below.<br />
<pre class="crayon-plain-tag">{
"majorDimension": "ROWS",
  "values": [
   ["Bob","bob@mycompany.com",55],
   ["Sam","sam@mycompany.com",57]
  ]
}</pre>
</li>
<li>Click Test Request / Response button. Check your Sheet in browser after it see it updates?</li>
<li>If you see <strong>200 OK</strong> response means we are good to go.</li>
<li>Run package and see your real data updated in Sheet.</li>
</ol>
</li>
</ol>
<h2>Format Cells using Google Sheet API</h2>
<p>Now let&#8217;s look at an example to format cell using Google Sheet API (e.g. Change Font, Color, Border, Background). For more information review <a href="https://developers.google.com/sheets/api/samples/formatting" target="_blank" rel="noopener">this API documentation</a>.</p>
<p>To format Sheet you first need to get SheetID  (keep in mind this is not same as spreadsheetId which you used in URL). SheetId is basically numeric ID of your Tab in WorkSheet.</p>
<h3>Get SheetID</h3>
<p><strong>Request</strong></p><pre class="crayon-plain-tag">GET https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHtxxxxxxxxxxxxxx</pre><p>
<strong>Response</strong></p><pre class="crayon-plain-tag">{
  "spreadsheetId": "1tuGO3_-2JlSmyiHwX6bRFUWqqrXlt4BRoX8rCHrORJc",
  "properties": {
    "title": "Test.xlsx",
    "locale": "en",
    "autoRecalc": "ON_CHANGE",
    "timeZone": "America/Los_Angeles",
    "defaultFormat": {
      "backgroundColor": {
        "red": 1,
        "green": 1,
        "blue": 1
      },
      "padding": {
        "right": 3,
        "left": 3
      },
      "verticalAlignment": "BOTTOM",
      "wrapStrategy": "OVERFLOW_CELL",
      "textFormat": {
        "foregroundColor": {},
        "fontFamily": "Calibri",
        "fontSize": 11,
        "bold": false,
        "italic": false,
        "strikethrough": false,
        "underline": false
      }
    }
  },
  "sheets": [
    {
      "properties": {
        "sheetId": 1896331083,
        "title": "Sheet1",
        "index": 0,
        "sheetType": "GRID",
        "gridProperties": {
          "rowCount": 1000,
          "columnCount": 26,
          "rowGroupControlAfter": true,
          "columnGroupControlAfter": true
        }
      }
    }
  ],
  "spreadsheetUrl": "https://docs.google.com/spreadsheets/d/1tuGO3_-2JlSmyiHwX6bRFUWqqrXlt4BRoX8rCHrORJc/edit"
}</pre><p>
Notice that in above response we see <strong>&#8220;sheetId&#8221;: 1896331083</strong>. This ID we will use in the Update API to format Cells.</p>
<h3>Update Borders Example</h3>
<p>Here is the example of Google Sheet Formatting API <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#updatebordersrequest" target="_blank" rel="noopener">updateBorders Request</a></p><pre class="crayon-plain-tag">POST https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSxxxxlt4BRoX8rCHrORJc:batchUpdate
Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
  "requests": [
    {
      "updateBorders": {
        "range": {
          "sheetId": 1896331083,
          "startRowIndex": 0,
          "endRowIndex": 10,
          "startColumnIndex": 0,
          "endColumnIndex": 6
        },
        "top": {
          "style": "DASHED",
          "width": 1,
          "color": {
            "blue": 1.0
          },
        },
        "bottom": {
          "style": "DASHED",
          "width": 1,
          "color": {
            "blue": 1.0
          },
        },
        "innerHorizontal": {
          "style": "DASHED",
          "width": 1,
          "color": {
            "blue": 1.0
          },
        },
      }
    }
  ]
}</pre><p>
<strong>Response</strong></p><pre class="crayon-plain-tag">{
  "spreadsheetId": "1tuGO3_-2JlSmyiHwX6bRFUWqqrXlt4BRoX8rCHrORJc",
  "replies": [
    {}
  ]
}</pre><p>
&nbsp;</p>
<h3>Update Cell Font Style (Bold, Style, Color, Background)</h3>
<p>Now let&#8217;s look at how to use <a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#RepeatCellRequest" target="_blank" rel="noopener">repeateCellRequest</a> to apply certain type of formatting to multiple cells. This may be color, font style, background color.</p><pre class="crayon-plain-tag">POST https://sheets.googleapis.com/v4/spreadsheets/1tuGO3xxxxxx4BRoX8rCHrORJc:batchUpdate
Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
  "requests": [
    {
      "repeatCell": {
        "range": {
          "sheetId": 1896331083,
          "startRowIndex": 0,
          "endRowIndex": 1
        },
        "cell": {
          "userEnteredFormat": {
            "backgroundColor": {
              "red": 0,
              "green": 0.5,
              "blue": 0.7,
              "alpha": 1.3
            },
            "textFormat": {
              "foregroundColor": {
                "red": 1
              },
              "bold": true,
              "italic": true,
              "strikethrough": true,
              "underline": true
            }
          }
        },
        "fields": "userEnteredFormat"
      }
    }
  ]
}</pre><p>
In above example we have applied <strong>textFormat</strong> and <strong>backgroundColor</strong> but you can use any of below sections.<br />
<div class="su-note"  style="border-color:#e5dd9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF7B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">
<span class="pun">{<br />
</span><span class="str">&#8220;numberFormat&#8221;<span class="pun">: </span><span class="pun">{</span><span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#NumberFormat">NumberFormat</a></code>)</span> <span class="pun">}</span><span class="pun">,</span><br />
&#8220;backgroundColor&#8221;<span class="pun">: </span><span class="pun">{</span> <span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#Color">Color</a></code>)</span> <span class="pun">}</span><span class="pun">,</span><br />
&#8220;borders&#8221;<span class="pun">: </span><span class="pun">{</span> <span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#Borders">Borders</a></code>)</span> <span class="pun">}</span><span class="pun">,</span><br />
&#8220;padding&#8221;<span class="pun">: </span><span class="pun">{</span> <span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#Padding">Padding</a></code>)</span> <span class="pun">}</span><span class="pun">,</span><br />
&#8220;horizontalAlignment&#8221;<span class="pun">: </span><span class="kwd">enum(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#HorizontalAlign">HorizontalAlign</a></code>)</span><span class="pun">,</span><br />
&#8220;verticalAlignment&#8221;<span class="pun">: </span><span class="kwd">enum(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#VerticalAlign">VerticalAlign</a></code>)</span><span class="pun">,</span><br />
&#8220;wrapStrategy&#8221;<span class="pun">: </span><span class="kwd">enum(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#WrapStrategy">WrapStrategy</a></code>)</span><span class="pun">,</span><br />
&#8220;textDirection&#8221;<span class="pun">: </span><span class="kwd">enum(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#TextDirection">TextDirection</a></code>)</span><span class="pun">,</span><br />
&#8220;textFormat&#8221;<span class="pun">: </span><span class="pun">{</span> <span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#TextFormat">TextFormat</a></code>)</span> <span class="pun">}</span><span class="pun">,<br />
</span> &#8220;hyperlinkDisplayType&#8221;<span class="pun">: </span><span class="kwd">enum(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#HyperlinkDisplayType">HyperlinkDisplayType</a></code>)</span><span class="pun">,</span><br />
&#8220;textRotation&#8221;<span class="pun">: </span><span class="pun">{</span> <span class="kwd">object(<code><a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#TextRotation">TextRotation</a></code>)</span> <span class="pun">}</span><br />
<span class="pun">}</span></span><br />
</div></div>
<h3>Set Currency Formatting</h3>
<p>Here is an example request to set currency formatting</p><pre class="crayon-plain-tag">POST https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6bRFUWqqrXlt4BRoX8rCHrORJc:batchUpdate
Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
  "requests": [
    {
      "repeatCell": {
        "range": {
          "sheetId": 1896331083,
          "startRowIndex": 1,
          "startColumnIndex": 4,
          "endColumnIndex": 5
        },
        "cell": {
          "userEnteredFormat": {
            "numberFormat": {
              "type": "CURRENCY",
              "pattern": "$#,##0.00"
            }
          }
        },
        "fields": "userEnteredFormat.numberFormat"
      }
    }
  ]
}</pre><p>
<h3>Set Cell Validation</h3>
<p>You can also set cell validation by calling following API call. This will restrict user&#8217;s ability to enter wrong data in certain cells.</p><pre class="crayon-plain-tag">POST https://sheets.googleapis.com/v4/spreadsheets/1tuGO3_-2JlSmyiHwX6bRFUWqqrXlt4BRoX8rCHrORJc:batchUpdate
Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
  "requests": [
    {
      "setDataValidation": {
        "range": {
          "sheetId": 1896331083,
          "startRowIndex": 1,
          "startColumnIndex": 0,
          "endColumnIndex": 6
        },
        "rule": {
          "condition": {
            "type": "ONE_OF_LIST",
            "values": [
              {
                "userEnteredValue": "Red"
              },
              {
                "userEnteredValue": "Green"
              },
              {
                "userEnteredValue": "Yellow"
              }
            ]
          },
          "inputMessage": "Color must be Red, Yellow or Green",
          "strict": true,
          "showCustomUi": true
        }
      }
    }
  ]
}</pre><p>
&nbsp;</p>
<h2>Dynamically obtain File ID for Google Drive REST API call</h2>
<p>Once OAuth connection is defined you can now call any valid API from Google based on Permission you requested in OAuth Connection. OAuth connection takes care of renewing you Token and passing Authorization as per OAuth standard. All these protocol complexity is hidden from you.</p>
<p>First step to get data from Google SpreadSheet using REST API call is get fileId of the Google Drive File you want to read. The easiest way to know file ID is call following API. Below API call returns name, ID and other information about file(s). You can get only fileID and use that in Next Section to export Google SpreadSheet to CSV format.</p><pre class="crayon-plain-tag">https://www.googleapis.com/drive/v3/files</pre><p>
OR</p><pre class="crayon-plain-tag">https://www.googleapis.com/drive/v3/files/?q=name%3D'Customers'</pre><p>
<strong>NOTE:</strong> For more information about searching files in Google drive / getting list of files using search expression language <a href="https://developers.google.com/drive/v3/web/search-parameters#examples" target="_blank" rel="noopener">check this link.</a> Make sure expression is URL encoded (e.g. name=&#8217;Customers&#8217; should be passed as name%3D&#8217;Customers&#8217;)</p>
<p>Above API returns response as below. Notice the name and fileId. We will use <strong>fileId</strong> when calling export API in next section.</p><pre class="crayon-plain-tag">{
 "kind": "drive#fileList",
 "files": [
  {
   "kind": "drive#file",
   "id": "1lkMEgu0zm2Q-cnPeoNZp4hqeIuASxXSpsrxtDDV89tg",
   "name": "Customers",
   "mimeType": "application/vnd.google-apps.spreadsheet"
  },
  {
   "kind": "drive#file",
   "id": "0B6UyXr6ZlIFTc3RhcnRlcl9maWxl",
   "name": "How to get started with Drive",
   "mimeType": "application/pdf"
  }
 ]
}</pre><p>
If you want to automate retrieval of fileId from document name then perform the following steps.</p>
<ol>
<li>In the SSIS package Control flow. Drag and drop ZS REST API Task from SSIS toolbox</li>
<li>In the Request Access mode, select &#8220;URL from Connection&#8221; option</li>
<li>Select OAuth connection manager (Created in Section-2)</li>
<li>Enter URL as below (It will return any file name equals to Customers (%3D is encoded value for = sign)<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/drive/v3/files/?q=name%3D'Customers'</pre>
</li>
<li>Click Test (You will see file information)
<div id="attachment_848" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-call-google-drive-api-get-file-list.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-848" class="wp-image-848" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-call-google-drive-api-get-file-list.png" alt="Get Google Drive File List in SSIS - Call Google Drive API. Search file by name or expression " width="600" height="451" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-call-google-drive-api-get-file-list.png 776w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-call-google-drive-api-get-file-list-300x225.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-848" class="wp-caption-text">Get Google Drive File List in SSIS &#8211; Call Google Drive API to search file by name or expression</p></div></li>
<li>If you want to extract only fileID from full JSON then go to response tab</li>
<li>Select Format=JSON, Enter following JSONPath expression to extract only fileId from first record<br />
<pre class="crayon-plain-tag">$.files[0].id</pre>
</li>
<li>Check save response content, select SSIS variable where you want to save fileId as below. Now click Test to see preview of response. You will notice now only fileId will be returned from full JSON response.
<div id="attachment_849" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-get-google-drive-fileid-from-file-name-using-api-call.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-849" class="wp-image-849" src="//zappysys.com/blog/wp-content/uploads/2016/09/ssis-get-google-drive-fileid-from-file-name-using-api-call.png" alt="Get Google Drive fileid from file name using api call in SSIS" width="600" height="475" srcset="https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-get-google-drive-fileid-from-file-name-using-api-call.png 681w, https://zappysys.com/blog/wp-content/uploads/2016/09/ssis-get-google-drive-fileid-from-file-name-using-api-call-300x237.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-849" class="wp-caption-text">Get Google Drive fileid from file name using API call in SSIS</p></div></li>
<li>Click OK to save task</li>
</ol>
<h2>Conclusion</h2>
<p>Google Drive API and Google Sheets API provides a great way to automate file related functionality. However, to call Google API  you have to use SDK / coding approach (e.g. C#, Java, Python, Ruby). Luckily ZappySys <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> provides a great way to integrate any Google API call via simple drag and drop approach without coding. Try out yourself see how long it takes to call virtually any REST API.</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/">How to read / write Google SpreadSheet using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to get data from Google AdWords using SSIS</title>
		<link>https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/</link>
					<comments>https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/#comments</comments>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Mon, 13 Jun 2016 16:32:55 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[AdWords]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[DFP]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google analytics]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[Google DoubleClick]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xml source]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=564</guid>

					<description><![CDATA[<p>Introduction Google AdWords is one of the most popular Advertise Platforms. In this article, you will learn how to get data from Google AdWords by calling Google AdWords Web Service method and using drag and drop SSIS XML/SOAP connector (No coding required :)). Google AdWords Web Services allows retrieving various data such as account info, campaigns; [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/">How to get data from Google AdWords using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<div class="su-note"  style="border-color:#e5de9d;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#FFF8B7;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><strong>UPDATE:</strong> ZappySys has released a brand new <a href="https://zappysys.com/api/integration-hub/google-ads-connector/">API Connector for Google AdWords</a> which makes it much simpler to <strong>Read/Write Google AdWords Data in SSIS/ODBC</strong> compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.</p>
<p>Please visit <a href="https://zappysys.com/api/integration-hub/">this page to see all</a> Pre-Configured ready to use API connectors which you can use in <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source</a> / <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-destination/">SSIS API Destination</a> OR <a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/">API ODBC Driver</a> (for non-SSIS Apps such as Excel, Power BI, Informatica).<br />
</div></div>
<p style="text-align: justify;"><strong><a href="//zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-api-integration.png"><img loading="lazy" decoding="async" class=" wp-image-1663 alignleft" src="//zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-api-integration.png" alt="" width="128" height="128" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-api-integration.png 273w, https://zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-api-integration-150x150.png 150w" sizes="(max-width: 128px) 100vw, 128px" /></a>Google AdWords</strong> is one of the most popular Advertise Platforms. In this article, you will learn <em>how to get data from Google AdWords</em> by calling Google AdWords Web Service method and using drag and drop <strong><a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML/SOAP connector</a></strong> (No coding required :)). Google AdWords Web Services allows retrieving various data such as account info, campaigns; as well as writing data, such as creating a campaign, add a keyword. Basically, it allows controlling your AdWords account programmatically instead of using the AdWords dashboard. For demo purposes, we will <strong>get data from Google AdWords</strong> Account and <strong>load it into Microsoft SQL Server </strong>(but you can use this technique to save any supported targets in SSIS (e.g. Excel, FlatFile, Oracle, MySQL, IBM DB2, etc.).</p>
<p>If you desire to download a report from AdWords, you must follow a different approach described in an <a href="https://zappysys.com/blog/download-adwords-report-using-google-api-odbc-xml-driver/">article on how to download AdWords report</a>. It describes how to download a report using ODBC and XML Driver but the concepts introduced there can be applied to SSIS as well.</p>
<p>If you are looking for a similar article for <strong>Google DoubleClick for Publisher</strong> (Google DFP) then <a href="//zappysys.com/blog/calling-google-dfp-api-with-ssis-doubleclick-soap-api/" target="_blank" rel="noopener">check this article</a>.</p>
<p>You will also learn <strong>how to create Google Ads</strong> or modify any other objects by calling SOAP API using <u><span style="color: #000080;">SSIS REST API Task</span></u>.</p>
<h2>SSIS Tasks/Connectors discussed in this Article</h2>
<p>In this article we will use following Connector(s) and Connection Manager to archive full data integration with Google AdWords.</p>
<p>Following SSIS Connectors support <strong>OAuth Connectivity</strong>. When you use below connectors no coding required to pull data from any OAuth enabled services (e.g. Twitter, Facebook, LinkedIn).</p>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr>
<td width="36"><span style="color: #248cc8"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-rest-api-web-service-task.png" alt="Custom SSIS Tasks - Call REST API Webservice (GET, POST, DELETE etc)" width="32" /></span></td>
<td><u><span style="color: #248cc8"><a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a></span></u></td>
</tr>
<tr>
<td width="36"><span style="color: #248cc8"><img decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/oauth-connection/ssis-oauth-connection-manager.png" alt="SSIS OAuth Connection Manager" width="32" /></span></td>
<td><a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener"><span style="color: #248cc8">OAuth Connection Manager</span></a></td>
</tr>
<tr>
<td width="36"><span style="color: #248cc8"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-xml-source.png" alt="Custom SSIS Components - XML Source (File, REST, SOAP)" width="32" /></span></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener"><span style="color: #248cc8">XML Source (REST API, SOAP Call or File data)</span></a></td>
</tr>
</tbody>
</table>
</div>
<h2>Two different ways to get Google AdWords Data in SSIS</h2>
<p>There are two ways you can extract Google AdWords data in SSIS.</p>
<ol>
<li>Use <a href="//zappysys.com/products/ssis-powerpack/ssis-google-analytics-source-connector/" target="_blank" rel="noopener">Google Analytics Source</a> (For more info <a href="//zappysys.com/blog/get-data-from-google-analytics-in-ssis-using-rest-api-call/" target="_blank" rel="noopener">see this article</a>)  (Consume AdWords data using Google Analytics REST API)</li>
<li>Use XML Source along with OAuth connection manager (Consume AdWords data using SOAP API)</li>
</ol>
<p>In this article we will only discuss Approach #2. For approach #1 refer <a href="//zappysys.com/blog/get-data-from-google-analytics-in-ssis-using-rest-api-call/#How_to_read_google_Adwords_Data_using_Google_Analytics_Source" target="_blank" rel="noopener">see this link</a></p>
<p>Advantage of #2 is you get total control of full API set for AdWords but you have to do lot more manual work. For Approach #1 is lot simpler but you get access to limited reports (Dimensions and Metrics).</p>
<h2>Google AdWords API Integration Example Screenshot</h2>
<p>Below is screenshot of sample package discussed in this article (<a href="//zappysys.com/blog/wp-content/uploads/2016/06/OAuthGoogleAdWords_2012.zip" target="_blank" rel="noopener">Download from here</a>). As you can see we tried to demonstrate Reading data and Managing data (e.g. Create Ad) in the same package. You can extend these technique to perform any type of operations in <strong>Google AdWords</strong> or similar service such as <strong>DoubleClick for Publisher</strong></p>
<div id="attachment_573" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-package-extract-google-adwords-data-soap-api-create-ad-get-campaigns.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-573" class="wp-image-573" src="//zappysys.com/blog/wp-content/uploads/2016/06/ssis-package-extract-google-adwords-data-soap-api-create-ad-get-campaigns.png" alt="Google AdWords API Integration Example - Create Ad, Get Accounts, Get Campaigns, Get Ad Groups, Get Ads (Extract AdWords data via SOAP API) , Read data using Selector Method or use AWQL query language" width="600" height="391" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-package-extract-google-adwords-data-soap-api-create-ad-get-campaigns.png 732w, https://zappysys.com/blog/wp-content/uploads/2016/06/ssis-package-extract-google-adwords-data-soap-api-create-ad-get-campaigns-300x195.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-573" class="wp-caption-text">Google AdWords API Integration Example &#8211; Create Ad, Get Accounts, Get Campaigns, Get Ad Groups, Get Ads (Extract AdWords data via SOAP API, Read data using Selector Method or use AWQL query language)</p></div>
<h2>Step-By-Step Tutorial</h2>
<p>Here are few high level steps you will have to perform to extract data from <strong>Google AdWords API</strong> using SSIS. This section assumes you have ClientID and Developer Token to access data. if you don&#8217;t have that then read next 2-3 sections.</p>
<ol>
<li>Download and install <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack from here</a></li>
<li>Create new SSIS Project</li>
<li>From SSIS toolbox drag DataFlow Task and go to dataflow designer</li>
<li>From toolbox of drag <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/">ZS XML Source</a></li>
<li>Double click <strong>XML Source</strong> to configure it</li>
<li>Specify API URL from which you want to read data<br />
Example : <span style="text-decoration: underline;">https://adwords.google.com/api/adwords/mcm/<strong>v201509</strong>/ManagedCustomerService</span></li>
<li>Now check Use Credentials check box and select New <strong>ZS-OAuth</strong> connection manager.</li>
<li>On connection manager UI you can select <strong>Google</strong> from Provider Dropdown.</li>
<li>Under Scopes enter following (Scope is basically permission)<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/adwords</pre>
&nbsp;</li>
<li>Now click <strong>Generate Token</strong> and when prompted login and in the last step Accept.</li>
<li>If everything went ok then you will see <strong>AccessToken</strong> and <strong>RefreshToken</strong> populated.</li>
<li>Click <strong>Test connection</strong> and close the UI by clicking OK</li>
<li>Now on XML Source &#8211; Select HTTP Request Method as <strong>POST</strong></li>
<li>In the Request Body click edit and enter request as below (Replace DEV_TOKEN and CLIENT_ID placeholders below)<br />
<pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
	&lt;soap:Header&gt;
		&lt;RequestHeader xmlns="https://adwords.google.com/api/adwords/mcm/v201605"&gt;
			&lt;developerToken&gt;ENTER_YOUR_DEV_TOKEN_HERE&lt;/developerToken&gt;
			&lt;clientCustomerId&gt;ENTER_YOUR_CLIENT_ID_HERE&lt;/clientCustomerId&gt;
			&lt;userAgent&gt;ZappySys SSIS PowerPack v1&lt;/userAgent&gt;
		&lt;/RequestHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;get xmlns="https://adwords.google.com/api/adwords/mcm/{{User::ApiVersion}}"&gt;
			&lt;serviceSelector&gt;
				&lt;fields&gt;CustomerId&lt;/fields&gt;
				&lt;fields&gt;Name&lt;/fields&gt;
			&lt;/serviceSelector&gt;
		&lt;/get&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre>
&nbsp;</p>
<div class="su-note"  style="border-color:#e5e5c6;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;"><div class="su-note-inner su-u-clearfix su-u-trim" style="background-color:#ffffe0;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;">
<p>If you are wondering how did we get above XML fragment for Request Body then <a href="//zappysys.com/blog/calling-soap-web-service-in-ssis-xml-source/" target="_blank" rel="noopener">Check this article on how to use SoapUI (free 3rd party tool) to create SOAP request Bodyfrom WSDL</a>. Google AdWords has many API endpoints for different service. For each service you have different Api URL and different WSDL. In the next section you can learn how to create correct SOAP Body (for POST) using <strong>SoapUI</strong> tool.</p>
<p>For example if you are calling ManagedCustomerService API for version <strong>v201609</strong> then your <strong>help page URL would be like this</strong><br />
<a href="https://developers.google.com/adwords/api/docs/reference/v201609/ManagedCustomerService" target="_blank" rel="noopener">https://developers.google.com/adwords/api/docs/reference/v201609/ManagedCustomerService</a></p>
<p>And on the same page you will see <strong>WSDL link below</strong><br />
<a href="https://ads.google.com/apis/ads/publisher/v201702/NetworkService?wsdl" target="_blank" rel="noopener">https://ads.google.com/apis/ads/publisher/v201702/NetworkService?wsdl</a><br />
(Just download that WSDL XML and save to local disk then use with SoapUI to generate XML body to submit for any DFP API call.)</p>
<p><a href="//zappysys.com/blog/calling-google-dfp-api-with-ssis-doubleclick-soap-api/#How_to_generate_SOAP_Request_Body_using_SoapUI_tool" target="_blank" rel="noopener">See this link for more information</a> (Its for Google DoubleClick Ad Platform but you will get an idea)</p>
</div></div></li>
<li>Go to Array handling tab at the bottom and enter text : <strong>ns2:entries</strong> &#8211; By doing this we will treat <strong>&lt;ns2:entries&gt;</strong> node as array eventhough only one entry found in response (By default content with multiple records treated as array).
<div id="attachment_571" style="width: 430px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/soap-xml-response-array-handling-adwords-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-571" class="size-full wp-image-571" src="//zappysys.com/blog/wp-content/uploads/2016/06/soap-xml-response-array-handling-adwords-api.png" alt="Handling Array Element Nodes in SOAP Response" width="420" height="134" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/soap-xml-response-array-handling-adwords-api.png 420w, https://zappysys.com/blog/wp-content/uploads/2016/06/soap-xml-response-array-handling-adwords-api-300x96.png 300w" sizes="(max-width: 420px) 100vw, 420px" /></a><p id="caption-attachment-571" class="wp-caption-text">Handling Array Element Nodes in SOAP Response</p></div></li>
<li>On the filter expression click edit and highlight entries node and click ok. This will produce something like below in filter textbox<br />
<pre class="crayon-plain-tag">$.soap:Envelope.soap:Body.ns2:getResponse.ns2:rval.ns2:entries[*]</pre>
&nbsp;</li>
<li>Now click preview to see actual data.</li>
<li>Click OK to save UI. Now you can connect source to target such as SQL Server or <a href="//zappysys.com/onlinehelp/ssis-powerpack/scr/trash-destination.htm" target="_blank" rel="noopener">Trash Destination</a>.</li>
</ol>
<blockquote><p>NOTE: in above example we used v201605 API version but change it to latest if this API is no more valid. Google expires API version pretty often so keep that in mind if you get depreciated API version error.</p></blockquote>
<h2>Register for Developer Token to access AdWords account data using API</h2>
<p>First important step to access any Google AdWords Account is request developer token. <a href="https://developers.google.com/adwords/api/docs/guides/first-api-call" target="_blank" rel="noopener">Click this link</a> for step by step information. Watch short vide to get overview on entire process to access data via API.</p>
<h2>Find your Client ID</h2>
<p>Next thing you will need to know is your ClientID. Most of API Requests will require your ClientID. Perform following steps to find your ClientID.</p>
<p>Login to your AdWords Account using email address. At the top you will see your client ID as below screenshot.</p>
<div id="attachment_567" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-account-client-id-for-soap-api-calls.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-567" class="wp-image-567" src="//zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-account-client-id-for-soap-api-calls.png" alt="How to find ClientID of your Google AdWords Account (Useful for making SOAP API Calls)" width="600" height="174" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-account-client-id-for-soap-api-calls.png 920w, https://zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-account-client-id-for-soap-api-calls-300x87.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-567" class="wp-caption-text">How to find ClientID of your Google AdWords Account (Useful for making SOAP API Calls)</p></div>
<p>&nbsp;</p>
<h2>Connect to Google AdWords API using OAuth</h2>
<p>Connecting to any Google API will require OAuth 2.0. SSIS PowerPack has Protocol so you can easily extract data from API without coding complex token extract/renew workflow. Such things usually requires some sort of programming but in our case you will do few clicks as described in Step-By-Step section earlier.</p>
<p>Here is the screenshot of OAuth Connection Manager.</p>
<div id="attachment_575" style="width: 660px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/calling-google-adwords-api-using-oauth-in-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-575" class="wp-image-575" src="//zappysys.com/blog/wp-content/uploads/2016/06/calling-google-adwords-api-using-oauth-in-ssis.png" alt="Connecting to Google AdWords API using OAuth 2.0 in SSIS (Consuming XML/SOAP API)" width="650" height="403" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/calling-google-adwords-api-using-oauth-in-ssis.png 932w, https://zappysys.com/blog/wp-content/uploads/2016/06/calling-google-adwords-api-using-oauth-in-ssis-300x186.png 300w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-575" class="wp-caption-text">Connecting to Google AdWords API using OAuth 2.0 in SSIS (Consuming XML/SOAP API)</p></div>
<p>&nbsp;</p>
<h2>Extract data from Google AdWords using SOAP API Calls</h2>
<p>When you define filter expression you can check/uncheck &#8220;Include Parent Columns&#8221; setting. For AdWords SOAP Api you can uncheck so you only extract columns from rvals node in XML Response.</p>
<div id="attachment_576" style="width: 560px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-api-select-xml-path-soap-request.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-576" class="wp-image-576" src="//zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-api-select-xml-path-soap-request.png" alt="Extract data from Google AdWords SOAP/XML Response" width="550" height="444" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-api-select-xml-path-soap-request.png 686w, https://zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-api-select-xml-path-soap-request-300x242.png 300w" sizes="(max-width: 550px) 100vw, 550px" /></a><p id="caption-attachment-576" class="wp-caption-text">Extract data from Google AdWords SOAP/XML Response</p></div>
<p>&nbsp;</p>
<h2>SOAP Response Paging / Looping</h2>
<p>Many time you will get response which is larger than default page size in AdWords API Call. In that case you can specify few pagination attributes on XML Source Paging tab. For more information on paging options you may refer <a href="//zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">this article</a> . This article is talking about JSON Source but same options are applicable for XML Source too.</p>
<div id="attachment_626" style="width: 513px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/04/ssis-xml-soap-api-pagination-google-adwords-pass-page-number.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-626" class="size-full wp-image-626" src="//zappysys.com/blog/wp-content/uploads/2016/04/ssis-xml-soap-api-pagination-google-adwords-pass-page-number.png" alt="REST API Pagination - Passing PageNumber inside POST Body (Example: Google AdWords SOAP Api)" width="503" height="547" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-xml-soap-api-pagination-google-adwords-pass-page-number.png 503w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-xml-soap-api-pagination-google-adwords-pass-page-number-276x300.png 276w" sizes="(max-width: 503px) 100vw, 503px" /></a><p id="caption-attachment-626" class="wp-caption-text">REST API Pagination &#8211; Passing PageNumber inside POST Body (Example: Google AdWords SOAP Api)</p></div>
<p>&nbsp;</p>
<div id="attachment_625" style="width: 665px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/04/ssis-rest-api-pagination-pass-page-number-inside-request-body-post-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-625" class="size-full wp-image-625" src="//zappysys.com/blog/wp-content/uploads/2016/04/ssis-rest-api-pagination-pass-page-number-inside-request-body-post-data.png" alt="Configure REST API Pagination - using Page Number via POST Body Method" width="655" height="447" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-rest-api-pagination-pass-page-number-inside-request-body-post-data.png 655w, https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-rest-api-pagination-pass-page-number-inside-request-body-post-data-300x205.png 300w" sizes="(max-width: 655px) 100vw, 655px" /></a><p id="caption-attachment-625" class="wp-caption-text">Configure REST API Pagination &#8211; using Page Number via POST Body Method</p></div>
<h2>Read Google AdWords data and Load into SQL Server</h2>
<p>Using XML Source you can extract data in tabular format and then you can map that to SQL Server Target (Use OLEDB Destination / ADO.net Destination).</p>
<div id="attachment_579" style="width: 719px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/extract-data-from-google-adwords-load-into-sql-server-using-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-579" class="size-full wp-image-579" src="//zappysys.com/blog/wp-content/uploads/2016/06/extract-data-from-google-adwords-load-into-sql-server-using-ssis.png" alt="Extract data from Google AdWords and load into SQL Server table using SSIS" width="709" height="403" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/extract-data-from-google-adwords-load-into-sql-server-using-ssis.png 709w, https://zappysys.com/blog/wp-content/uploads/2016/06/extract-data-from-google-adwords-load-into-sql-server-using-ssis-300x171.png 300w" sizes="(max-width: 709px) 100vw, 709px" /></a><p id="caption-attachment-579" class="wp-caption-text">Extract data from Google AdWords and load into SQL Server table using SSIS</p></div>
<h2>Write data / Manage AdWords Account via REST API Calls</h2>
<p>So far we have seen how to read data from AdWords account. But what if you have to create new records or write/update AdWords data via API Calls in automated manner? No worry &#8211; If you have need for that then use <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">SSIS REST API Task</a> which supports adhoc HTTP WebRequests including POST/DELETE/PUT etc. You can also upload files via REST API call using this task. This task supports rich error handling and saving your response into variable or files.</p>
<h3>Create Ad under specific AdGroup</h3>
<p>Below example shows how to create new ad under specific AdGroup using <u><span style="color: #000080;">REST API Task</span></u></p>
<p>Notice we have used few placeholders to make things dynamic using SSIS Variables. Once REST API Task is executed you will see new ad created.</p>
<div id="attachment_577" style="width: 590px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-create-new-ad-using-soap-xml-api-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-577" class="wp-image-577" src="//zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-create-new-ad-using-soap-xml-api-ssis.png" alt="Creating Google AdWords Ad using SOAP/XML API in SSIS (REST API Task)" width="580" height="464" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-create-new-ad-using-soap-xml-api-ssis.png 703w, https://zappysys.com/blog/wp-content/uploads/2016/06/google-adwords-create-new-ad-using-soap-xml-api-ssis-300x240.png 300w" sizes="(max-width: 580px) 100vw, 580px" /></a><p id="caption-attachment-577" class="wp-caption-text">Creating Google AdWords Ad using SOAP/XML API in SSIS (REST API Task)</p></div>
<div id="attachment_578" style="width: 660px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/06/create-new-google-adwords-ad-via-soap-api-in-ssis.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-578" class="wp-image-578" src="//zappysys.com/blog/wp-content/uploads/2016/06/create-new-google-adwords-ad-via-soap-api-in-ssis.png" alt="Verify Google Ad created programmatically using SOAP/XML API Call (SSIS REST API Task)" width="650" height="353" srcset="https://zappysys.com/blog/wp-content/uploads/2016/06/create-new-google-adwords-ad-via-soap-api-in-ssis.png 916w, https://zappysys.com/blog/wp-content/uploads/2016/06/create-new-google-adwords-ad-via-soap-api-in-ssis-300x163.png 300w" sizes="(max-width: 650px) 100vw, 650px" /></a><p id="caption-attachment-578" class="wp-caption-text">Verify Google Ad created programmatically using SOAP/XML API Call (SSIS REST API Task)</p></div>
<h2>Methods for Creating new records</h2>
<p>Google AdWords API supports <strong>mutate</strong> method for writing data. Many service endpoints supports this method. Below example request will create new Ad.</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
	&lt;soap:Header&gt;
		&lt;RequestHeader xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;
			&lt;developerToken&gt;{{User::varDevToken}}&lt;/developerToken&gt;
			&lt;clientCustomerId&gt;{{User::varClientId}}&lt;/clientCustomerId&gt;
			&lt;userAgent&gt;My Test AdWords App (AwApi-DotNet/18.20.0, Common-Dotnet/3.11.0, .NET CLR/4.0.30319.18444, gzip)&lt;/userAgent&gt;
		&lt;/RequestHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;mutate xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;
			&lt;operations&gt;
				&lt;operator&gt;ADD&lt;/operator&gt;
				&lt;operand&gt;
	                &lt;adGroupId&gt;30800928123&lt;/adGroupId&gt;
	                &lt;ad xsi:type="TextAd"&gt;
	                    &lt;displayUrl&gt;//zappysys.com/ad1&lt;/displayUrl&gt;
	                    &lt;finalUrls&gt;//zappysys.com/ad1&lt;/finalUrls&gt;
	                    &lt;headline&gt;This is my Ad&lt;/headline&gt;
	                    &lt;description1&gt;This is Line 1&lt;/description1&gt;
	                    &lt;description2&gt;This is Line 2&lt;/description2&gt;
	                &lt;/ad&gt;            
				&lt;/operand&gt;
			&lt;/operations&gt;
		&lt;/mutate&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
<h2>Methods for Reading AdWords data</h2>
<p>Google AdWords API supports two methods for reading data. Most of AdWords service endpoints supports GET method also known as Selector method (Its basically sending query in XML format). Seconds method is Query Method. It uses SQL like query language known as <a href="https://developers.google.com/adwords/api/docs/guides/awql" target="_blank" rel="noopener">AWQL</a>. (Read more about <a href="https://developers.google.com/adwords/api/docs/guides/awql" target="_blank" rel="noopener">AWQL query language</a>). If you are SQL Programmer then you may like AWQL Query method better than Selector. But either way you will be able to pass following information.</p>
<ul>
<li>Columns you want to return</li>
<li>Filter (e.g. Where Clause)</li>
<li>Order By</li>
<li>Paging information (e.g. PageNumber, PageSize)</li>
</ul>
<h3>Get Method (XML Selector)</h3>
<p>For Get Method using XML tags to define columns, filters and order by/paging information. Here is example Get method for below select query</p><pre class="crayon-plain-tag">SELECT Id, Heading
WHERE Status = 'ENABLED'
ORDER BY Heading DESC 
LIMIT 0,50</pre><p>
<strong>Get Request (Get all Active Ads)</strong></p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
	&lt;soap:Header&gt;
		&lt;RequestHeader xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;
			&lt;developerToken xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;{{User::varDevToken}}&lt;/developerToken&gt;
			&lt;clientCustomerId xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;{{User::varClientId}}&lt;/clientCustomerId&gt;
			&lt;userAgent xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;My Test AdWords App (AwApi-DotNet/18.20.0, Common-Dotnet/3.11.0, .NET CLR/4.0.30319.18444, gzip)&lt;/userAgent&gt;
		&lt;/RequestHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;get xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;
			&lt;serviceSelector&gt;
			    &lt;fields&gt;Id&lt;/fields&gt;
			    &lt;fields&gt;Headline&lt;/fields&gt;
			    &lt;predicates&gt;
			        &lt;field&gt;Status&lt;/field&gt;
			        &lt;operator&gt;EQUALS&lt;/operator&gt;
			        &lt;values&gt;ENABLED&lt;/values&gt;
			    &lt;/predicates&gt;
			    &lt;ordering&gt;
			        &lt;field&gt;Headline&lt;/field&gt;
			        &lt;sortOrder&gt;ASCENDING&lt;/sortOrder&gt;
			    &lt;/ordering&gt;
			    &lt;paging&gt;
			        &lt;startIndex&gt;0&lt;/startIndex&gt;
			        &lt;numberResults&gt;50&lt;/numberResults&gt;
			    &lt;/paging&gt;
			&lt;/serviceSelector&gt;
		&lt;/get&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
<h3>Query Method (AWQL Query &#8211; SQL like query language)</h3>
<p>Below is sample Soap request for AWQL Method to read Ads listed under from specific AdGroups. To learn more AWQL Query Syntax <a href="https://developers.google.com/adwords/api/docs/guides/awql" target="_blank" rel="noopener">Click Here</a>.</p>
<p>To learn more about which Columns you can use inside your AWQL Query <a href="https://developers.google.com/adwords/api/docs/appendix/selectorfields#v201605-AdGroupAdService" target="_blank" rel="noopener">Click here.</a> Note that each service support different fields for Select Clause, Where Clause and Order By Clause. AWQL language can be also used to query Predefined AdWords Reports. The only difference is .. FROM clause is required when you query Reports.</p><pre class="crayon-plain-tag">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
	&lt;soap:Header&gt;
		&lt;RequestHeader xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;
			&lt;developerToken xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;YOUR_DEV_TOKEN&lt;/developerToken&gt;
			&lt;clientCustomerId xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;YOUR_CLIENT_ID&lt;/clientCustomerId&gt;
			&lt;userAgent xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;My Test AdWords App (AwApi-DotNet/18.20.0, Common-Dotnet/3.11.0, .NET CLR/4.0.30319.18444, gzip)&lt;/userAgent&gt;
		&lt;/RequestHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;query xmlns="https://adwords.google.com/api/adwords/cm/v201605"&gt;
			&lt;query&gt;
SELECT Id, Name
WHERE Status = 'ENABLED'
LIMIT 0,5
			&lt;/query&gt;
		&lt;/query&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
&nbsp;</p>
<h2>Call AdWords Reports API &#8211; Download Campaign Performance data</h2>
<p>There will be a time you like to <a href="https://developers.google.com/adwords/api/docs/guides/reporting#http_request_url" target="_blank" rel="noopener">download Reports from Adwords</a>. For that  <a href="https://zappysys.com/blog/download-adwords-report-using-google-api-odbc-xml-driver/" target="_blank" rel="noopener">read this article</a>. Its showing how to use ZappySys ODBC Driver to call AdWords Reporting API but concept is same in SSIS Product too due to similar UI elements.</p>
<h2>Download Example SSIS Package</h2>
<p><a href="//zappysys.com/blog/wp-content/uploads/2016/06/OAuthGoogleAdWords_2012.zip">Download SSIS 2012 / 2014/ 2016 Sample</a></p>
<h2>Conclusion</h2>
<p><em>Google AdWords data integration</em> can be very challenging without right set of tools. <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a> certainly makes it easy when you have to extract/manage Google AdWords data. Innovative drag and drop approach gives you various options to cover simple or most advanced scenarios without relying on any Programming language (e.g. C#, Java, Python, Ruby etc).</p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/">How to get data from Google AdWords using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Get data from Google Analytics in SSIS using REST API Call</title>
		<link>https://zappysys.com/blog/get-data-from-google-analytics-in-ssis-using-rest-api-call/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Fri, 08 Jan 2016 14:54:01 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[SSIS Google Analytics Source]]></category>
		<category><![CDATA[AdWords]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google analytics]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=294</guid>

					<description><![CDATA[<p>Introduction Google Analytics is the most popular web analytics service that tracks and reports website traffic. In this blog post you will learn how to get data from Google Analytics using SSIS using SSIS Google Analytics Source Connector (Using drag and drop approach without Coding). This article assumes you have basic knowledge about SSIS and [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-google-analytics-in-ssis-using-rest-api-call/">Get data from Google Analytics in SSIS using REST API Call</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Google Analytics is the most popular web analytics service that tracks and reports website traffic. In this blog post you will learn how to <em>get data from Google Analytics using SSIS using <a href="//zappysys.com/products/ssis-powerpack/ssis-google-analytics-source-connector/">SSIS Google Analytics Source Connector</a> (Using drag and drop approach without Coding).</em> This article assumes you have basic knowledge about SSIS and you have necessary tools installed &#8211; <a href="http://binaryworld.net/blogs/how-to-install-ssis-2012-2014-2016-ssdt-bi-visual-studio/" target="_blank" rel="noopener">Check this if not</a>)</p>
<p>For demo purpose we will <em>load data from Google Analytics into SQL Server Database</em> but you can use same techniques to load data into Oracle, MySQL, Excel or any other RDBMS.</p>
<h2>Prerequisite</h2>
<p>This article assumes you have installed following tools</p>
<ol>
<li>Install Client Tools for SSIS (atleast one version from below list) &#8211; <a href="http://binaryworld.net/blogs/how-to-install-ssis-2012-2014-2016-ssdt-bi-visual-studio/" target="_blank" rel="noopener">Check this for detail</a>
<ol>
<li>BIDS for SSIS 2008 (i.e. SQL Server 2008 or 2008 R2) &#8212; OR &#8212;</li>
<li>SSDT BI for Visual Studio 2012 (i.e. for SQL Server 2012) &#8212; OR &#8212;</li>
<li>SSDT BI for Visual Studio 2013 (i.e. for SQL Server 2014) &#8212; OR &#8212;</li>
<li>SSDT BI for Visual Studio 2015 (i.e. for SQL Server 2012/2014 or 2016)</li>
</ol>
</li>
<li>Install SSIS PowerPack (<a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Click here to download</a>) it will add new Connector in SSIS Toolbox to access Google Analytics Connector.</li>
<li>You have setup correct permission for user to access google analytics data (See below section or <a href="//zappysys.com/blog/get-data-from-google-analytics-in-ssis-using-rest-api-call/#Setup_Google_analytics_data_permission_for_other_users" target="_blank" rel="noopener">read here</a>)</li>
</ol>
<h2>Video Tutorial &#8211; Get data from Google Web Analytics Platform</h2>
<a href="https://zappysys.com/blog/get-data-from-google-analytics-in-ssis-using-rest-api-call/"><img decoding="async" src="https://zappysys.com/blog/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2Fgr_s9kdvrKw%2Fhqdefault.jpg" alt="YouTube Video"></a><br /><br /></p>
<h2>What is Google Analytics Connector for SSIS?</h2>
<p>The<em> SSIS Google Analytics Source</em> connector can be used to read data from your Google Analytics Service without learning complex APIs or coding/scripting in Python, Java, C#, etc. It has an easy to use drag and drop interface which allows you to extract large amounts of data, adjusting parameters such as dimensions, metrics, filters, sortby, date range etc. You can also use in-built reports or specify a direct query URL to get the desired data.</p>
<p><img loading="lazy" decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-source.png" alt="Custom SSIS Components - Google Web Analytics Source Connector" width="53" height="53" /> Read more about <a href="//zappysys.com/products/ssis-powerpack/ssis-google-analytics-source-connector/" target="_blank" rel="noopener"><span style="color: #248cc8;">Google Analytics Source Connector</span></a></p>
<h3>Features</h3>
<ul>
<li>The intuitive user interface makes Google Analytics data integration super easy and fast without learning complex APIs or scripting languages</li>
<li>Support for OAuth 2.0 Authentication and Google service accounts (*.p12 certificate file)</li>
<li>Support for Proxy Server</li>
<li>Easy to use interface with three different ways to query Google Analytics data: (1) Build query from UI, (2) Use built-in query templates, and (3) Use direct queries</li>
<li>Support for dynamic dimensions, metrics, segments, filters and sortby fields (e.g. supply these values at runtime)</li>
<li>Live preview support at design time</li>
<li>Support for AdWords, AdSense, Ad Exchange and DoubleClick for Publisher (DFP)</li>
</ul>
<h2>Setup Google analytics data permission for users / service account</h2>
<p>If you are not an admin of Google analytics and you need to access google analytics then make sure you ask admin to give you correct permission using below steps</p>
<p>To add/edit user permissions for Google Analytics Data perform following steps.</p>
<ol>
<li>Login to your Google Analytics Portal (Login using Admin account or use google user account who setup Google Analytics) <a href="https://analytics.google.com/analytics/web/#management/Settings/" target="_blank" rel="noopener">Click here</a> to go to google analytics</li>
<li>Click on Admin tab &gt; Click User management &gt; Add/Edit user account permission</li>
</ol>
<p>For more information you may visit official link : <a href="https://support.google.com/analytics/answer/2884495?hl=en" target="_blank" rel="noopener">How to setup permission for google analytics</a></p>
<div id="attachment_534" style="width: 808px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/01/set-permission-google-analytics-service-account.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-534" class="size-full wp-image-534" src="//zappysys.com/blog/wp-content/uploads/2016/01/set-permission-google-analytics-service-account.png" alt="Add/Edit Permissions and User Account for Google Analytics Data Access (Service Account/ Normal Google Login)" width="798" height="600" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/set-permission-google-analytics-service-account.png 798w, https://zappysys.com/blog/wp-content/uploads/2016/01/set-permission-google-analytics-service-account-300x226.png 300w" sizes="(max-width: 798px) 100vw, 798px" /></a><p id="caption-attachment-534" class="wp-caption-text">Add/Edit Permissions and User Account for Google Analytics Data Access (Service Account/ Normal Google Login)</p></div>
<div>
<h3>How to setup permissions for Service Account (*.p12 certificate)</h3>
<p>Service account is another method to access google data. This is useful when you don&#8217;t want to use google login to access data (Example: Some consultant working to setup automated jobs for your company and they don&#8217;t really have login for google or you don&#8217;t want to share your personal google login with them).</p>
<p>Service Account method (*.p12 certificate file) doesn&#8217;t require complex flow like OAuth so no more authorization prompts but make sure certificate generated for Service Account is kept secret.</p>
<p>To grant permission to service account so it can access google analytics data, First make sure Service Account is created and find account email (It may look like this account-1234@some-project-id-xyz.gserviceaccount.com ) . <a href="//zappysys.com/blog/create-google-api-project-service-account/" target="_blank" rel="noopener">Click here to know more how to create google service account</a>. Once service account created you may follow same steps described in above section to setup permission for Google Analytics Data.</p>
<h2>Access Google Analytics data using OAuth 2.0 authentication protocol</h2>
<p><img decoding="async" class="figureimage" title="Google Data Connection UI - Access Web Google Analytics data using OAuth 2.0 authentication protocol" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-access-google-analytics-data-using-oauth-2-authentication.png" alt="Google Data Connection UI - Access Google Web Analytics data using OAuth 2.0 authentication protocol" /></p>
</div>
<p>&nbsp;</p>
<div>
<h2>Access Google Analytics Data using service account method (*.P12 Certificate file)</h2>
<p><img decoding="async" class="figureimage" title="Google Data Connection UI - Access Google Web Analytics data using service account method (*.P12 Certificate file)" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-access-google-analytics-data-using-service-account.png" alt="SSIS Google Web Analytics Connector - Access data using service account method (*.P12 Certificate file) - Get data from Google Web Analytics Platform" /></p>
</div>
<p>&nbsp;</p>
<h2>SSIS Google Analytics Connector &#8211; Select Web Profile</h2>
<p><img decoding="async" class="figureimage" title="Google API - Select Web Profile" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-select-web-profile.png" alt="Google REST API - Select Web Profile" /></p>
<div>
<h2>SSIS Google Analytics Connector &#8211; Using build your own query mode</h2>
<p><img decoding="async" class="figureimage" title="Google API - Automatic URL mode (Build your own query from UI)" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-automatic-mode.png" alt="Google REST API - Automatic URL mode (Build your own query from UI)" /></p>
</div>
<p>&nbsp;</p>
<div>
<h2>SSIS Google Analytics Connector &#8211; Using direct query mode</h2>
<p><img decoding="async" class="figureimage" title="Google API - Manual URL mode (Supply predefined URL)" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-manual-url-mode.png" alt="Google REST API - Manual URL mode (Supply predefined URL)" /></p>
</div>
<p>&nbsp;</p>
<div>
<h2>SSIS Google Analytics Connector &#8211; Predefined Report Templates</h2>
<p><img decoding="async" class="figureimage" title="Google API - Predefined Reports mode" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-template-report-mode.png" alt="Google REST API - Predefined Reports mode" /></p>
</div>
<p>&nbsp;</p>
<div>
<h2>SSIS Google Analytics Connector &#8211; Report Preview</h2>
<p><img decoding="async" class="figureimage" title="Google API - Predefined Report Preview" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-report-template-preview.png" alt="Google REST API - Predefined Report Preview - Get data from Google Web Analytics Platform" /></p>
</div>
<p>&nbsp;</p>
<div>
<h2>SSIS Google Analytics Connector &#8211; Select Dimensions</h2>
<p><img decoding="async" class="figureimage" title="Google API - Select Dimensions" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-select-dimensions.png" alt="Google REST API - Select Dimensions - Get data from Google Web Analytics Platform" /></p>
</div>
<p>&nbsp;</p>
<div>
<h2>SSIS Google Analytics Connector &#8211; Select Metrics</h2>
<p><img decoding="async" class="figureimage" title="Google API - Select Metrics" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-select-metrics.png" alt="Google REST API - Select Metrics" /></p>
</div>
<p>&nbsp;</p>
<div>
<h2>SSIS Google Analytics Connector &#8211; Select Filters</h2>
<p><img decoding="async" class="figureimage" title="Google API - Select Filters" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-select-filters.png" alt="Google REST API - Select Filters - Get data from Google Web Analytics Platform" /></p>
</div>
<p>&nbsp;</p>
<div>
<h2>SSIS Google Analytics Connector &#8211; Select Segment</h2>
<p><img decoding="async" class="figureimage" title="Google API - Select Segment" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-select-segment.png" alt="Google REST API - Select Segment" /></p>
</div>
<p>&nbsp;</p>
<div>
<h2>How to read google Adwords Data using Google Analytics Source</h2>
<p>If you wish to access Google AdWords data using Google Analytics source then refer instructions listed on AdWords Tab on the UI. Once you enable integration you can view AdWords data easily without any other connector (see below)</p>
</div>
<div id="attachment_862" style="width: 738px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/01/ssis-get-google-adwords-data-using-analytics-source-connector.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-862" class="size-full wp-image-862" src="//zappysys.com/blog/wp-content/uploads/2016/01/ssis-get-google-adwords-data-using-analytics-source-connector.png" alt="Get Data from Google AdWords using SSIS ( use Google Analytics Source Connector)" width="728" height="591" srcset="https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-get-google-adwords-data-using-analytics-source-connector.png 728w, https://zappysys.com/blog/wp-content/uploads/2016/01/ssis-get-google-adwords-data-using-analytics-source-connector-300x244.png 300w" sizes="(max-width: 728px) 100vw, 728px" /></a><p id="caption-attachment-862" class="wp-caption-text">Get Data from Google AdWords using SSIS ( use Google Analytics Source Connector)</p></div>
<div>
<p>&nbsp;</p>
<h2>SSIS Package &#8211; Get data from Google Web Analytics Platform and load into SQL Server</h2>
<p><img decoding="async" class="figureimage" title="SSIS Package - Get data from Google Web Analytics Platform and load into SQL Server" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-extract-google-analytics-data-load-into-sql-server-target.png" alt="SSIS Package - Get data from Google Web Analytics Platform and load into SQL Server" /></p>
</div>
<h2>Conclusion</h2>
<p>Integration with Google Analytics Data can be challenging unless you understand how to write C#, Java, Python code using Google SDKs. If you are not a coder or you are in time crunch then drag and drop integration in <strong>SSIS</strong> using High quality Connector using ZappySys <a href="//zappysys.com/products/ssis-powerpack/ssis-google-analytics-source-connector/"><span style="color: #248cc8;">Google Analytics Source Connector</span></a> will surely make your life easy. It supports all major SQL Server versions upto SQL Server 2016 32-bit/64-bit. Try <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a> yourself for FREE.</p>
<h2>Keywords</h2>
<p><strong>Fetch data from Google Web Analytics using SSIS</strong> | <strong>Extract google analytics data using SSIS</strong> | <strong>Load data from Google Analytics without Coding</strong> | <strong>Google Web analytics data import using REST API</strong></p>
<p><a href="https://developers.google.com/analytics/devguides/reporting/core/v3/" target="_blank" rel="noopener">Google Web Analytics Reporting REST API reference link</a></p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-google-analytics-in-ssis-using-rest-api-call/">Get data from Google Analytics in SSIS using REST API Call</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
