<?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 api Archives | ZappySys Blog</title>
	<atom:link href="https://zappysys.com/blog/tag/google-api/feed/" rel="self" type="application/rss+xml" />
	<link>https://zappysys.com/blog/tag/google-api/</link>
	<description>SSIS / ODBC Drivers / API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more</description>
	<lastBuildDate>Thu, 19 Mar 2026 23:11:01 +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 api Archives | ZappySys Blog</title>
	<link>https://zappysys.com/blog/tag/google-api/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to upload files on Google Drive using SSIS</title>
		<link>https://zappysys.com/blog/upload-files-google-drive-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Thu, 07 Sep 2023 12:18:50 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[SSIS API Source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[Foreach Loop Container]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[Google Drive]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis advanced file system task]]></category>
		<category><![CDATA[upload files]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=10255</guid>

					<description><![CDATA[<p>Introduction In today&#8217;s data-driven world, the ability to seamlessly integrate and transfer files between different platforms is crucial for efficient business operations. If you&#8217;re a user of SQL Server Integration Services (SSIS) and looking to integrate Google Drive into your data workflow, you&#8217;re in luck. ZappySys SSIS PowerPack offers a powerful Google Drive Connector that [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/upload-files-google-drive-using-ssis/">How to upload files on Google Drive using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><strong>Introduction</strong></h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2023/11/google_drive_logo.png"><img loading="lazy" decoding="async" class="alignleft wp-image-11097" src="https://zappysys.com/blog/wp-content/uploads/2023/11/google_drive_logo-300x284.png" alt="" width="106" height="100" srcset="https://zappysys.com/blog/wp-content/uploads/2023/11/google_drive_logo-300x284.png 300w, https://zappysys.com/blog/wp-content/uploads/2023/11/google_drive_logo-768x727.png 768w, https://zappysys.com/blog/wp-content/uploads/2023/11/google_drive_logo.png 980w" sizes="(max-width: 106px) 100vw, 106px" /></a>In today&#8217;s data-driven world, the ability to seamlessly integrate and transfer files between different platforms is crucial for efficient business operations. If you&#8217;re a user of SQL Server Integration Services (SSIS) and looking to integrate Google Drive into your data workflow, you&#8217;re in luck. ZappySys SSIS PowerPack offers a powerful <a href="https://zappysys.com/api/integration-hub/google-drive-connector/">Google Drive Connector</a> that makes uploading files to Google Drive a breeze. In this guide, we&#8217;ll walk you through the process of uploading files to Google Drive using SSIS and the <a href="https://zappysys.com/api/integration-hub/google-drive-connector/ssis">ZappySys SSIS PowerPack Google Drive Connector</a>.</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>Upload files to Google Drive with SSIS:</h2>
<p>In this section, we will learn how to configure and use Google Drive Connector in the API Source to upload files on Google Drive.</p>
<ol>
<li>Begin with opening Visual Studio and Creating a New Project.</li>
<li>Select Integration Service Project and in the new project window set the appropriate name and location for the project. Click OK.</li>
<li>In the new SSIS project screen you will find the following:
<ol style="list-style-type: lower-alpha;">
<li>SSIS ToolBox on the left sidebar</li>
<li>Solution Explorer and Property Window on the right bar</li>
<li>Control flow, data flow, event Handlers, Package Explorer in tab windows</li>
<li>Connection Manager Window at the bottom</li>
</ol>
<div id="attachment_10258" style="width: 710px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/upload-files-google-drive-using-ssis/zappysys-ssis-project-with-toolbox/#main"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10258" class="wp-image-10258" src="https://zappysys.com/blog/wp-content/uploads/2023/08/zappysys-ssis-project-with-toolbox-1024x653.png" alt="zappysys ssis project with toolbox" width="700" height="447" srcset="https://zappysys.com/blog/wp-content/uploads/2023/08/zappysys-ssis-project-with-toolbox-1024x653.png 1024w, https://zappysys.com/blog/wp-content/uploads/2023/08/zappysys-ssis-project-with-toolbox-300x191.png 300w, https://zappysys.com/blog/wp-content/uploads/2023/08/zappysys-ssis-project-with-toolbox-768x490.png 768w, https://zappysys.com/blog/wp-content/uploads/2023/08/zappysys-ssis-project-with-toolbox.png 1287w" sizes="(max-width: 700px) 100vw, 700px" /></a><p id="caption-attachment-10258" class="wp-caption-text">SSIS Toolbox &#8211; ZappySys Tasks</p></div>
<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 you don&#8217;t see ZappySys SSIS PowerPack Task or Components in the SSIS Toolbox, please refer to <a href="https://zappysys.zendesk.com/hc/en-us/articles/115004935754-I-don-t-see-PowerPack-components-in-SSIS-Toolbox">this help link</a>.</div></div></li>
<li>Now, Drag and Drop the SSIS Data Flow Task from the SSIS Toolbox. Double-click on the Data Flow Task to see the Data Flow Designer.<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2023/08/drag-and-drop-data-flow-task.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10260" src="https://zappysys.com/blog/wp-content/uploads/2023/08/drag-and-drop-data-flow-task.png" alt="" width="460" height="155" srcset="https://zappysys.com/blog/wp-content/uploads/2023/08/drag-and-drop-data-flow-task.png 460w, https://zappysys.com/blog/wp-content/uploads/2023/08/drag-and-drop-data-flow-task-300x101.png 300w" sizes="(max-width: 460px) 100vw, 460px" /></a></li>
<li>From the SSIS toolbox drag and drop API Source (Predefined Templates) on the data flow designer surface, and double-click on it to edit it:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-drag-and-drop.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10262" src="https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-drag-and-drop.jpg" alt="" width="659" height="292" srcset="https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-drag-and-drop.jpg 659w, https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-drag-and-drop-300x133.jpg 300w" sizes="(max-width: 659px) 100vw, 659px" /></a></li>
<li>Select <strong>New Connection</strong> to create a new connection:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-new-connection.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10263" src="https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-new-connection.png" alt="" width="684" height="643" srcset="https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-new-connection.png 684w, https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-new-connection-300x282.png 300w" sizes="(max-width: 684px) 100vw, 684px" /></a></li>
</ol>
<h2>Configuring the Google Drive Connector</h2>
<ol>
<li>Use a preinstalled Google Drive Connector from the Popular Connector List or press the Search Online radio button to download Google Drive Connector. Once downloaded simply use it in the configuration:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-template-selection-googledrive-walkthrough.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10354" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-template-selection-googledrive-walkthrough.png" alt="ssis googledrive template selection walkthrough" width="781" height="686" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-template-selection-googledrive-walkthrough.png 781w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-template-selection-googledrive-walkthrough-300x264.png 300w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-template-selection-googledrive-walkthrough-768x675.png 768w" sizes="(max-width: 781px) 100vw, 781px" /></a></li>
<li>Proceed with selecting the desired Authentication Type. Then select API Base URL (in most cases default one is the right one). Finally, fill in all the required parameters and set optional parameters if needed.</li>
<li>After configuring all the required properties in the API Connection Manager, please click on the &#8220;Test Connection&#8221; button to confirm that the connection is established successfully.<br />
<h3>Method1: Connect to Google Drive using User Account [OAuth]</h3>
<p>You may press a link <a href="https://zappysys.com/api/integration-hub/google-drive-connector/help/authentication/OAuth"><strong>Steps to Configure</strong></a> which will help set certain parameters.</p>
<div id="attachment_10355" style="width: 876px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-generate-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10355" class="size-full wp-image-10355" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-generate-token.png" alt="SSIS API Source - Generate Token - Google Drive with User Account" width="866" height="773" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-generate-token.png 866w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-generate-token-300x268.png 300w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-generate-token-768x686.png 768w" sizes="(max-width: 866px) 100vw, 866px" /></a><p id="caption-attachment-10355" class="wp-caption-text">SSIS API Source &#8211; Generate Token &#8211; Google Drive with User Account</p></div>
<h3>Method2: Connect to Google Drive using Service Account [OAuth]</h3>
<p>You may press a link <a href="https://zappysys.com/api/integration-hub/google-drive-connector/help/authentication/ServiceAccount"><strong>Steps to Configure</strong></a> which will help set certain parameters.</p>
<div id="attachment_10353" style="width: 876px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-serviceaccount-generate-token.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10353" class="size-full wp-image-10353" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-serviceaccount-generate-token.png" alt="SSIS API Source - Generate Token - Google Drive with Service Account" width="866" height="773" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-serviceaccount-generate-token.png 866w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-serviceaccount-generate-token-300x268.png 300w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-serviceaccount-generate-token-768x686.png 768w" sizes="(max-width: 866px) 100vw, 866px" /></a><p id="caption-attachment-10353" class="wp-caption-text">SSIS API Source &#8211; Generate Token &#8211; Google Drive with Service Account</p></div></li>
</ol>
<h2>How to upload a local file to Google Drive</h2>
<p>In the API Source Component, we&#8217;ve chosen the API Connection Manager. Next, we need to configure the remaining properties of the component to upload a local file to Google Drive.</p>
<ol>
<li>Choose the <strong>Upload a file</strong> endpoint from the &#8220;Select Table/Endpoint&#8221; dropdown menu.</li>
<li>To access detailed API documentation for uploading files, you can click on the following link: <a href="https://developers.google.com/drive/api/reference/rest/v3/files/create"><strong>Help for: Upload File</strong></a>.</li>
<li>Please specify the desired filename for the uploaded file by setting the <strong>FileName</strong> parameter.</li>
<li>Specify the desired local file path by setting the <strong>DiskFilePath</strong> parameter.</li>
<li>If you wish to upload the local file to a specific folder in Google Drive, please choose the folder ID from the dropdown menu labeled <strong>ParentFolderId</strong>. Otherwise, you can skip this parameter as it&#8217;s optional.</li>
</ol>
<p>Please refer to the sample screenshot below.</p>
<div id="attachment_10357" style="width: 896px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-single-file-upload.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10357" class="size-full wp-image-10357" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-single-file-upload.png" alt="SSIS API Source - Google Drive - Upload Single File" width="886" height="603" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-single-file-upload.png 886w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-single-file-upload-300x204.png 300w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-single-file-upload-768x523.png 768w" sizes="(max-width: 886px) 100vw, 886px" /></a><p id="caption-attachment-10357" class="wp-caption-text">SSIS API Source &#8211; Google Drive &#8211; Upload Single File</p></div>
<p>Once you have configured all the mentioned properties above, please click on the &#8220;Preview Data&#8221; button to initiate the API call. With just a few clicks, we have successfully configured the call to Google Drive using the <strong>ZappySys Google Drive Connector</strong> for uploading a local file to Google Drive.</p>
<h2>How to upload multiple files to Google Drive</h2>
<p>In the API Source Component, we&#8217;ve selected the API Connection Manager. Next, we need to configure the remaining properties of the component to upload multiple files to Google Drive. Additionally, we should utilize a Foreach Loop Container to iterate through each file one by one in a loop.</p>
<ol>
<li>Create 3 SSIS variables as described below.<br />
<table border="1">
<tbody>
<tr>
<th>Variable Name</th>
<th>Datatype</th>
<th>Value</th>
</tr>
<tr>
<td>varFileLists</td>
<td>Object</td>
<td>System.Object</td>
</tr>
<tr>
<td>varFileName</td>
<td>String</td>
<td>fake.extension</td>
</tr>
<tr>
<td>varFullFilePath</td>
<td>String</td>
<td>C:/fake/fake.extension</td>
</tr>
</tbody>
</table>
</li>
<li>Go to Control Flow, From the SSIS toolbox drag and drop <strong>ZS Advanced File System Task</strong> on the control flow designer surface, and double click on it to edit it:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-advanced-file-system-task-drag-and-drop.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10363" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-advanced-file-system-task-drag-and-drop.png" alt="SSIS Advanced File System Task - Drag &amp; Drop" width="580" height="241" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-advanced-file-system-task-drag-and-drop.png 580w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-advanced-file-system-task-drag-and-drop-300x125.png 300w" sizes="(max-width: 580px) 100vw, 580px" /></a></li>
<li>Select the &#8220;Get file list as ADO.NET Data Table&#8221; action from the Action drop-down menu. Set the file path in the Path textbox. Choose the variable (Object type) where you want to store the file list, and then click the OK button to save the settings.
<div id="attachment_10364" style="width: 722px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-advanced-file-system-task-store-filelists-adotable-in-object-variable.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10364" class="size-full wp-image-10364" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-advanced-file-system-task-store-filelists-adotable-in-object-variable.png" alt="SSIS Advanced File System Task - Get file list as ADO.net Data Table" width="712" height="623" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-advanced-file-system-task-store-filelists-adotable-in-object-variable.png 712w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-advanced-file-system-task-store-filelists-adotable-in-object-variable-300x263.png 300w" sizes="(max-width: 712px) 100vw, 712px" /></a><p id="caption-attachment-10364" class="wp-caption-text">SSIS Advanced File System Task &#8211; Get file list as ADO.net Data Table</p></div></li>
<li>Now, drag and drop the &#8220;Foreach Loop Container&#8221; from the SSIS Toolbox and connect it with the &#8220;ZS Advanced File System Task.&#8221; Double-click on the &#8220;Foreach Loop Container&#8221; to edit its properties.
<div id="attachment_10365" style="width: 750px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-foreach-loop-container-drag-and-drop-googledrive.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10365" class="size-full wp-image-10365" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-foreach-loop-container-drag-and-drop-googledrive.png" alt="SSIS Foreach Loop Container - Drag &amp; Drop" width="740" height="531" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-foreach-loop-container-drag-and-drop-googledrive.png 740w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-foreach-loop-container-drag-and-drop-googledrive-300x215.png 300w" sizes="(max-width: 740px) 100vw, 740px" /></a><p id="caption-attachment-10365" class="wp-caption-text">SSIS Foreach Loop Container &#8211; Drag &amp; Drop</p></div></li>
<li>In the Foreach Loop Editor&#8217;s &#8220;Collection&#8221; tab, choose the Enumerator as &#8220;Foreach ADO Enumerator.&#8221; In the &#8220;ADO object source variable&#8221; field, select your SSIS object-typed variable. Select the &#8220;Rows in the first table&#8221; radio option.
<div id="attachment_10371" style="width: 747px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-googledrive-multiplefiles-upload-foreach-loop-editor-collection-tab-configuration.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10371" class="size-full wp-image-10371" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-googledrive-multiplefiles-upload-foreach-loop-editor-collection-tab-configuration.png" alt="SSIS Foreach Loop Editor - Collection - Select Variable &amp; Enumeration mode" width="737" height="631" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-googledrive-multiplefiles-upload-foreach-loop-editor-collection-tab-configuration.png 737w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-googledrive-multiplefiles-upload-foreach-loop-editor-collection-tab-configuration-300x257.png 300w" sizes="(max-width: 737px) 100vw, 737px" /></a><p id="caption-attachment-10371" class="wp-caption-text">SSIS Foreach Loop Editor &#8211; Collection &#8211; Select Variable &amp; Enumeration mode</p></div></li>
<li>In the Foreach Loop Editor&#8217;s &#8220;Variable Mappings&#8221; tab, select the variables that you want to map to the values from the collection, and then click the &#8220;OK&#8221; button to save your selections.
<div id="attachment_10370" style="width: 747px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-googledrive-multiplefiles-upload-foreach-loop-editor-variablemappings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10370" class="size-full wp-image-10370" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-googledrive-multiplefiles-upload-foreach-loop-editor-variablemappings.png" alt="SSIS Foreach Loop Editor - Variable Mappings tab" width="737" height="631" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-googledrive-multiplefiles-upload-foreach-loop-editor-variablemappings.png 737w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-googledrive-multiplefiles-upload-foreach-loop-editor-variablemappings-300x257.png 300w" sizes="(max-width: 737px) 100vw, 737px" /></a><p id="caption-attachment-10370" class="wp-caption-text">SSIS Foreach Loop Editor &#8211; Variable Mappings</p></div></li>
<li>Inside the Foreach Loop Container, drag and drop the Data Flow Task, and then rename it according to your preference.
<div id="attachment_10374" style="width: 716px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-dataflow-task-inside-foreachloop-container-googledrive-multiplefiles-upload.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10374" class="size-full wp-image-10374" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-dataflow-task-inside-foreachloop-container-googledrive-multiplefiles-upload.png" alt="SSIS Data Flow Task - Drag &amp; Drop inside Foreach Loop Container" width="706" height="420" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-dataflow-task-inside-foreachloop-container-googledrive-multiplefiles-upload.png 706w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-dataflow-task-inside-foreachloop-container-googledrive-multiplefiles-upload-300x178.png 300w" sizes="(max-width: 706px) 100vw, 706px" /></a><p id="caption-attachment-10374" class="wp-caption-text">SSIS Data Flow Task &#8211; Drag &amp; Drop inside Foreach Loop Container</p></div></li>
<li>Double-click on the Data Flow Task to see the Data Flow Designer, From the SSIS toolbox drag and drop API Source (Predefined Templates) on the data flow designer surface, and double click on it to edit it:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-drag-and-drop.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-10262" src="https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-drag-and-drop.jpg" alt="SSIS API Source - Drag &amp; Drop" width="659" height="292" srcset="https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-drag-and-drop.jpg 659w, https://zappysys.com/blog/wp-content/uploads/2023/08/ssis-api-source-drag-and-drop-300x133.jpg 300w" sizes="(max-width: 659px) 100vw, 659px" /></a></li>
<li>Double-click on the <strong>API Source</strong> component to configure it for uploading multiple files to Google Drive.
<ol style="list-style-type: lower-alpha;">
<li>Choose the <strong>Upload a file</strong> endpoint from the &#8220;Select Table/Endpoint&#8221; dropdown menu.</li>
<li>To access detailed API documentation for uploading files, you can click on the following link: <a href="https://developers.google.com/drive/api/reference/rest/v3/files/create"><strong>Help for: Upload File</strong></a>.</li>
<li>Please specify the desired SSIS Variable [varFileName] which contains file name for the uploaded file by setting the <strong>FileName</strong> parameter.</li>
<li>To specify the desired local SSIS variable [varFullFilePath], which holds the file path, set the <strong>DiskFilePath</strong> parameter.<br />
When configuring the SSIS variable directly in the Raw Edit, JSON may become invalid due to the requirement of slashes within the local file path. To address this, we use a JSONENC Placeholder Function for proper escaping.<br />
<pre class="crayon-plain-tag">&lt;&lt;{{User::varUserFullFilePath}},FUN_JSONENC&gt;&gt;</pre></li>
<li>If you wish to upload the local file to a specific folder in Google Drive, please choose the folder ID from the dropdown menu labeled <strong>ParentFolderId</strong>. Otherwise, you can skip this parameter as it&#8217;s optional.</li>
</ol>
<p>Please refer to the sample screenshot below.</p>
<div id="attachment_10369" style="width: 896px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-multiple-files-upload.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-10369" class="size-full wp-image-10369" src="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-multiple-files-upload.png" alt="SSIS API Source - Google Drive - Upload Multiple files - configuration" width="886" height="603" srcset="https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-multiple-files-upload.png 886w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-multiple-files-upload-300x204.png 300w, https://zappysys.com/blog/wp-content/uploads/2023/09/ssis-api-source-googledrive-multiple-files-upload-768x523.png 768w" sizes="(max-width: 886px) 100vw, 886px" /></a><p id="caption-attachment-10369" class="wp-caption-text">SSIS API Source &#8211; Google Drive &#8211; Upload Multiple files configuration</p></div>
<p>To configure dynamic filenames and file paths, you can set variables. Click on &#8220;Raw Edit,&#8221; and in the &#8220;Edit Parameters&#8221; popup, you can use SSIS variables, as shown in the image below.</p>
<p>Once you have configured all the mentioned properties above, please click on the &#8220;Preview Data&#8221; button to initiate the API call. With just a few clicks, we have successfully configured the call to Google Drive using the <strong>ZappySys Google Drive Connector</strong> for uploading multiple files to Google Drive.</li>
</ol>
<h2>Conclusion</h2>
<p>In this blog, we learned how to connect with Google Drive using SSIS API Connection Manager and upload single or multiple files to Google Drive using a combination of SSIS components, including the <a href="https://zappysys.com/products/ssis-powerpack/ssis-api-source/">SSIS API Source component</a>, <a href="https://zappysys.com/products/ssis-powerpack/ssis-file-system-task-advanced/">SSIS ZS Advanced File System Task</a>, Foreach Loop Container, and SSIS variables.</p>
<p>The post <a href="https://zappysys.com/blog/upload-files-google-drive-using-ssis/">How to upload files on Google Drive using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Get data from Google Search Console API in SSIS and ODBC Apps</title>
		<link>https://zappysys.com/blog/get-data-google-search-console-api-ssis-odbc-drivers/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 09 Oct 2019 20:22:28 +0000</pubDate>
				<category><![CDATA[JSON File / REST API Driver]]></category>
		<category><![CDATA[ODBC Gateway]]></category>
		<category><![CDATA[ODBC PowerPack]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS REST API Task]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[oauth]]></category>
		<guid isPermaLink="false">https://zappysys.com/blog/?p=8128</guid>

					<description><![CDATA[<p>Introduction In our previous few posts we saw how to call various google apis in SSIS.  In this post lets learn how to call Google Search Console API in SSIS or other ODBC Compatible Apps such as Power BI, Informatica, SSRS using API Drivers for ODBC About Google Search Console API (Google Webmaster API) If [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-search-console-api-ssis-odbc-drivers/">Get data from Google Search Console API in SSIS and ODBC Apps</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In our previous few posts we saw how to call various <a href="https://zappysys.com/blog/category/google-api/" target="_blank" rel="noopener">google apis</a> in SSIS.  In this post lets learn how to call Google Search Console API in SSIS or other ODBC Compatible Apps such as Power BI, Informatica, SSRS using <a href="https://zappysys.com/products/odbc-powerpack/">API Drivers for ODBC</a></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>About Google Search Console API (Google Webmaster API)</h2>
<p>If you are new to Google Search Console API (i.e. Webmaster API) then start <a href="https://developers.google.com/webmaster-tools/search-console-api-original/v3/prereqs" target="_blank" rel="noopener">from this link</a>. You can also <a href="https://developers.google.com/apis-explorer/#p/webmasters/v3/" target="_blank" rel="noopener">check API Explorer</a> here to test API requests.</p>
<p>Search API can be called by supplying either <a href="https://developers.google.com/webmaster-tools/search-console-api-original/v3/how-tos/authorizing#APIKey" target="_blank" rel="noopener">API key</a> in URL  or <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/">use OAuth</a></p>
<p>Search Console V3 Covers following APIs (May add more in future)</p>
<div class="su-table su-table-alternate">
<table class="NYYWNC-h-b">
<tbody>
<tr>
<td><strong><span class="gwt-InlineLabel">API Name</span></strong></td>
<td><strong><span class="gwt-InlineLabel">Description</span></strong></td>
</tr>
<tr>
<td class="NYYWNC-h-c"><span class="gwt-InlineLabel">webmasters.searchanalytics.query</span></td>
<td class="NYYWNC-h-a"><span class="gwt-InlineLabel">Query your data with filters and parameters that you define. Returns zero or more rows grouped by the row keys that you define. You must define a date range of one or more days. When date is one of the group by values, any days without data are omitted from the result list. If you need to know which days have data, issue a broad date range query grouped by date for any metric, and see which day rows are returned.</span></td>
</tr>
<tr>
<td class="NYYWNC-h-c"><span class="gwt-InlineLabel">webmasters.sitemaps.delete</span></td>
<td class="NYYWNC-h-a"><span class="gwt-InlineLabel">Deletes a sitemap from this site.</span></td>
</tr>
<tr>
<td class="NYYWNC-h-c"><span class="gwt-InlineLabel">webmasters.sitemaps.get</span></td>
<td class="NYYWNC-h-a"><span class="gwt-InlineLabel">Retrieves information about a specific sitemap.</span></td>
</tr>
<tr>
<td class="NYYWNC-h-c"><span class="gwt-InlineLabel">webmasters.sitemaps.list</span></td>
<td class="NYYWNC-h-a"><span class="gwt-InlineLabel">Lists the sitemaps-entries submitted for this site, or included in the sitemap index file (if sitemapIndex is specified in the request).</span></td>
</tr>
<tr>
<td class="NYYWNC-h-c"><span class="gwt-InlineLabel">webmasters.sitemaps.submit</span></td>
<td class="NYYWNC-h-a"><span class="gwt-InlineLabel">Submits a sitemap for a site.</span></td>
</tr>
<tr>
<td class="NYYWNC-h-c"><span class="gwt-InlineLabel">webmasters.sites.add</span></td>
<td class="NYYWNC-h-a"><span class="gwt-InlineLabel">Adds a site to the set of the user&#8217;s sites in Search Console.</span></td>
</tr>
<tr>
<td class="NYYWNC-h-c"><span class="gwt-InlineLabel">webmasters.sites.delete</span></td>
<td class="NYYWNC-h-a"><span class="gwt-InlineLabel">Removes a site from the set of the user&#8217;s Search Console sites.</span></td>
</tr>
<tr>
<td class="NYYWNC-h-c"><span class="gwt-InlineLabel">webmasters.sites.get</span></td>
<td class="NYYWNC-h-a"><span class="gwt-InlineLabel">Retrieves information about specific site.</span></td>
</tr>
<tr>
<td class="NYYWNC-h-c"><span class="gwt-InlineLabel">webmasters.sites.list</span></td>
<td class="NYYWNC-h-a"><span class="gwt-InlineLabel">Lists the user&#8217;s Search Console sites.</span></td>
</tr>
</tbody>
</table>
</div>
<p><strong>Search Console API Call Example</strong></p>
<p>Here is simple example of Search Console API call. Below example returns all sites you added under your search console account.</p>
<p><strong>Request</strong></p><pre class="crayon-plain-tag">GET https://www.googleapis.com/webmasters/v3/sites?key={YOUR_API_KEY}</pre><p>
<strong>Response</strong></p><pre class="crayon-plain-tag">{
 "siteEntry": [
  {
   "siteUrl": "https://my-google-search-api-1.com/",
   "permissionLevel": "siteOwner"
  },
  {
   "siteUrl": "https://www.my-google-search-api-1.com/",
   "permissionLevel": "siteOwner"
  },
  {
   "siteUrl": "https://my-google-search-api-2.com/",
   "permissionLevel": "siteOwner"
  },
  {
   "siteUrl": "https://www.my-google-search-api-2.com/",
   "permissionLevel": "siteOwner"
  }
 ]
}</pre><p>
&nbsp;</p>
<h2>Step-By-Step &#8211; Call Search Console API in SSIS</h2>
<p>Now lets look at very simple API call to <a href="https://developers.google.com/webmaster-tools/search-console-api-original/v3/sites/list" target="_blank" rel="noopener">list search console sites</a></p>
<ol>
<li>Open SSIS Package</li>
<li>Drag and drop ZS REST API Task from SSIS tool box
<div style="width: 565px" class="wp-caption alignnone"><img loading="lazy" decoding="async" class="size-full" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/rest-api-task/ssis-rest-api-web-service-task-drag.png" alt="Drag and Drop ZS REST API Task from SSIS Toolbox" width="555" height="199" /><p class="wp-caption-text">Drag and Drop ZS REST API Task from SSIS Toolbox</p></div></li>
<li>Now double click REST API Task and configure (Skip <strong>Step 5</strong> if you use <a href="https://developers.google.com/webmaster-tools/search-console-api-original/v3/how-tos/authorizing#APIKey" target="_blank" rel="noopener">API Key</a> instead of OAuth).</li>
<li>Enter API URL you like to call. For This example we will use simple URL as below<br />
<strong>OAuth based Authentication</strong><br />
<pre class="crayon-plain-tag">https://www.googleapis.com/webmasters/v3/sites/</pre>
<strong>API Key based Authentication</strong><br />
<pre class="crayon-plain-tag">https://www.googleapis.com/webmasters/v3/sites/?key={YOUR_API_KEY}</pre>
</li>
<li>If you want to use OAuth based credentials then perform the following steps
<ol>
<li>Select <strong>URL from Connection </strong></li>
<li>Click <strong>New ZS-OAUTH</strong> connection from Dropdown</li>
<li>On the OAuth UI select <strong>Google as Provider</strong></li>
<li>Enter Scopes as below<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/webmasters
https://www.googleapis.com/auth/webmasters.readonly</pre>
</li>
<li>Click Generate Token. When you get Login Prompt enter your Google Account information and <strong>click Accept</strong></li>
<li>Click OK to Save OAuth UI</li>
</ol>
</li>
<li>This is how it will look like if you use OAuth Connection
<div id="attachment_8131" style="width: 1037px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/call-google-search-api-using-oauth-ssis-rest-api-task.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8131" class="size-full wp-image-8131" src="https://zappysys.com/blog/wp-content/uploads/2019/10/call-google-search-api-using-oauth-ssis-rest-api-task.png" alt="Call Google Search Console API using SSIS REST API Task (OAuth Authentication)" width="1027" height="869" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/call-google-search-api-using-oauth-ssis-rest-api-task.png 1027w, https://zappysys.com/blog/wp-content/uploads/2019/10/call-google-search-api-using-oauth-ssis-rest-api-task-300x254.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/10/call-google-search-api-using-oauth-ssis-rest-api-task-768x650.png 768w, https://zappysys.com/blog/wp-content/uploads/2019/10/call-google-search-api-using-oauth-ssis-rest-api-task-1024x866.png 1024w" sizes="(max-width: 1027px) 100vw, 1027px" /></a><p id="caption-attachment-8131" class="wp-caption-text">Call Google Search Console API using SSIS REST API Task (OAuth Authentication)</p></div></li>
<li>Now click Test Request / Response to check if its working. You should get response like below</li>
</ol>
<p>&nbsp;</p>
<h2>Read from Search Console Analytics API (query)</h2>
<p>Now let&#8217;s look at how to <a href="https://developers.google.com/webmaster-tools/search-console-api-original/v3/searchanalytics/query" target="_blank" rel="noopener">call Search Console Analytics API (i.e. query)</a> for Specified Site and extract data in tabular format using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source</a>. In below example we will obtain search Impression, clicks, position etc for specified site. We will aggregate this over date and country (dimensions).</p>
<p>In this section you will learn how to use JSON Source Adapter to extract data from JSON file (In this case its Web URL).</p>
<ol>
<li>Firstly, You need to <b>Download and Install</b> SSIS <a href="https://zappysys.com/products/ssis-powerpack/download/" target="_blank" rel="noopener">ZappySys PowerPack.</a></li>
<li>Once you finished first step, Open Visual Studio and Create New SSIS Package Project.</li>
<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 Data Flow 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 configure like below
<ol>
<li>Enter URL as below. Notice two things, first we used <strong>&lt;&lt;somedata,FUN_URLENC&gt;&gt;</strong> <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-format-specifiers.htm" target="_blank" rel="noopener">placeholder function</a> to encode <strong>:</strong> and <strong>//</strong> in the URL so it <a href="https://zappysys.zendesk.com/hc/en-us/articles/360012261713">become %2F %3A</a>. We use <pre class="crayon-plain-tag">--dont-escape--</pre>  suffix at the end.<br />
<strong>For OAuth based Credentials</strong><br />
<pre class="crayon-plain-tag">https://www.googleapis.com/webmasters/v3/sites/&lt;&lt;https://mysite.com,FUN_URLENC&gt;&gt;/searchAnalytics/query--dont-escape--</pre>
<strong>For API Key based Credentials</strong><br />
<pre class="crayon-plain-tag">https://www.googleapis.com/webmasters/v3/sites/&lt;&lt;https://mysite.com,FUN_URLENC&gt;&gt;/searchAnalytics/query/?key={YOUR_API_KEY}--dont-escape--</pre>
</li>
<li>Check Use Credentials and select OAuth connection (created earlier) (if you are using API key in URL then skip this step).</li>
<li>Select <strong>POST</strong> as HTTP Method</li>
<li>Enter Body for Query. Here are <a href="https://developers.google.com/webmaster-tools/search-console-api-original/v3/how-tos/search_analytics" target="_blank" rel="noopener">some examples</a> for various queries you can use. For our case we want to group by date and country so use below<br />
<pre class="crayon-plain-tag">{
"startDate": "2019-01-01",
"endDate": "2019-01-10",
"dimensions" : ["date","country"]
}</pre>
</li>
<li>Select <strong>Content Type</strong> as <pre class="crayon-plain-tag">application/json</pre>  from Content Type drop down.</li>
<li>Select Filter or enter as  <pre class="crayon-plain-tag">$.rows[*]</pre></li>
<li>Now go to Extract Multiple Arrays Tab and <strong>Check Array Flattening Option</strong> (on older version it was on the different Tab)</li>
</ol>
</li>
<li>Click Preview and you will see your Google Search Console API data as below.
<div id="attachment_8138" style="width: 914px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/10/read-google-search-console-api-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8138" class="size-full wp-image-8138" src="https://zappysys.com/blog/wp-content/uploads/2019/10/read-google-search-console-api-example.png" alt="Read from Google Search API Console (Analytics Query Endpoint) - JSON Source" width="904" height="827" srcset="https://zappysys.com/blog/wp-content/uploads/2019/10/read-google-search-console-api-example.png 904w, https://zappysys.com/blog/wp-content/uploads/2019/10/read-google-search-console-api-example-300x274.png 300w, https://zappysys.com/blog/wp-content/uploads/2019/10/read-google-search-console-api-example-768x703.png 768w" sizes="(max-width: 904px) 100vw, 904px" /></a><p id="caption-attachment-8138" class="wp-caption-text">Read from Google Search API Console (Analytics Query Endpoint) &#8211; JSON Source</p></div></li>
</ol>
<h2>Loading Google Search Console API data into SQL Server / Other Target</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>
<p>&nbsp;</p>
<h2>Import Google Search Console API data in Reporting / other ETL tools (ODBC Usecase)</h2>
<p>There will be a time when you dont want to use SSIS connector like mentioned in previous sections but extract Google Search API data in Reporting Tools / Other ETL Platform.  Good news is you can use <a href="https://zappysys.com/products/odbc-powerpack/odbc-json-rest-api-driver/" target="_blank" rel="noopener">ZappySys ODBC Driver for JSON / REST API</a> in ODBC Apps. See few popular ODBC Apps below.</p>
<ul>
<li>Power BI connection for Google Search Console API</li>
<li>Excel connection for Google Search Console API</li>
<li>Informatica connection for Google Search Console API</li>
<li>MS Access connection for Google Search Console API</li>
<li>C# , PowerShell, VB.net connection for Google Search Console API</li>
</ul>
<div id="attachment_6416" style="width: 766px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6416" class="size-full wp-image-6416" src="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png" alt="Preview / Generate Query in JSON Driver / XML Driver" width="756" height="432" srcset="https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query.png 756w, https://zappysys.com/blog/wp-content/uploads/2019/01/odbc-json-driver-generate-quickbooks-query-300x171.png 300w" sizes="(max-width: 756px) 100vw, 756px" /></a><p id="caption-attachment-6416" class="wp-caption-text">Preview / Generate Query in JSON Driver / XML Driver</p></div>
<h2></h2>
<h2>Load Google Search Console API in SQL Server without any ETL</h2>
<p>Now let&#8217;s look at even more interesting integration scenario. If you have SQL Server and like to load Google Search Console API without any ETL then you can use <a href="https://zappysys.com/products/odbc-powerpack/data-gateway/" target="_blank" rel="noopener">Data Gateway</a></p>
<p>Read this article to learn how to <a href="https://zappysys.com/blog/import-rest-api-json-sql-server/" target="_blank" rel="noopener">load REST API in SQL Server</a> without any coding (Use just T-SQL) .</p>
<p>You can write query like below to load data inside SQL Table.</p><pre class="crayon-plain-tag">SELECT * FROM OPENQUERY([MY_LINKED_SERVER]
, 'SELECT * FROM $
WITH(
	 Src=''https://www.googleapis.com/webmasters/v3/sites/&lt;&lt;https://mysite.com,FUN_URLENC&gt;&gt;/searchAnalytics/query/?key={YOUR_API_KEY}--dont-escape--''
	,Filter=''$.rows[*]''
	,RequestData=''{
"startDate": "2019-01-01",
"endDate": "2019-01-10",
"dimensions" : ["date","country"]
}''
	,RequestContentTypeCode=''ApplicationJson''
	,Header=''cache-control: no-cache || Accept: */*''
	,RequestMethod=''POST''
	,EnableArrayFlattening=''True''
)')</pre><p>
<div id="attachment_5293" style="width: 899px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2018/11/query-rest-api-sql-server-linked-server-openquery-zappysys-data-gateway.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-5293" class="size-full wp-image-5293" src="https://zappysys.com/blog/wp-content/uploads/2018/11/query-rest-api-sql-server-linked-server-openquery-zappysys-data-gateway.png" alt="SSMS Output - Query REST API via Linked Server OPENQUERY statement (Connect to ZappySys Data Gateway)" width="889" height="481" srcset="https://zappysys.com/blog/wp-content/uploads/2018/11/query-rest-api-sql-server-linked-server-openquery-zappysys-data-gateway.png 889w, https://zappysys.com/blog/wp-content/uploads/2018/11/query-rest-api-sql-server-linked-server-openquery-zappysys-data-gateway-300x162.png 300w, https://zappysys.com/blog/wp-content/uploads/2018/11/query-rest-api-sql-server-linked-server-openquery-zappysys-data-gateway-768x416.png 768w" sizes="(max-width: 889px) 100vw, 889px" /></a><p id="caption-attachment-5293" class="wp-caption-text">SSMS Output &#8211; Query REST API via Linked Server OPENQUERY statement (Connect to ZappySys Data Gateway)</p></div>
<h2>Conclusion</h2>
<p>So in this post we saw how easy it is to achieve total REST API integration in SSIS using JSON Connector. We also saw how to use ODBC Drivers to query REST API data inside Apps like Excel, MS Access, Informatica and other ODBC Apps using ODBC JSON / REST API driver. If you are SSIS User download <a href="https://zappysys.com/products/ssis-powerpack/">SSIS PowerPack and try for FREE</a> and if you don&#8217;t have SSIS in house and want to try more generic approach then <a href="https://zappysys.com/products/odbc-powerpack/" target="_blank" rel="noopener">Download ODBC PowerPack Drivers for FREE Trial</a>.</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-search-console-api-ssis-odbc-drivers/">Get data from Google Search Console API in SSIS and ODBC Apps</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to read / write data in Google BigQuery using SSIS</title>
		<link>https://zappysys.com/blog/get-data-google-bigquery-using-ssis/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sun, 16 Jul 2017 01:10:44 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[SSIS JSON Generator Transform]]></category>
		<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS WEB API Destination]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[big data]]></category>
		<category><![CDATA[fiddler]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[Google BigQuery]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis json source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis web api destination]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1563</guid>

					<description><![CDATA[<p>Introduction Google BigQuery is a fully managed Big Data platform to run queries against large scale data. In this article you will learn how to integrate Google BigQuery data into Microsoft SQL Server using SSIS. We will leverage highly flexible JSON based REST API Connector and OAuth Connection to import / export data from Google [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-bigquery-using-ssis/">How to read / write data in Google BigQuery 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-bigquery-connector/">API Connector for BigQuery Online</a> which makes it much simpler to <strong>Read/Write BigQuery 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>
<p style="text-align: left;"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1.png"><img loading="lazy" decoding="async" class="alignleft wp-image-1959" src="//zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1-150x150.png" alt="Google BigQuery API Integration" width="91" height="91" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-big-query-integration-1.png 257w" sizes="(max-width: 91px) 100vw, 91px" /></a><a href="https://cloud.google.com/bigquery/" target="_blank" rel="noopener">Google BigQuery</a> is a fully managed <strong>Big Data platform</strong> to run queries against large scale data. In this article you will learn how to integrate <strong>Google BigQuery</strong> data into <strong>Microsoft SQL Server</strong> using <strong>SSIS</strong>. We will leverage highly flexible <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">JSON based REST API Connector</a> and <strong>OAuth Connection</strong> to import / export data from <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/" target="_blank" rel="noopener">Google BigQuery API</a> just in a few clicks.</p>
<p style="text-align: left;">If you are looking for a similar product inside Amazon AWS Cloud then <a href="https://zappysys.com/blog/import-export-data-amazon-athena-using-ssis/" target="_blank" rel="noopener">check an article about Amazon Athena</a>.</p>
<h2><span id="Prerequisites">Prerequisites</span></h2>
<p>Before we look into a Step-By-Step section to extract and load data from BigQuery to SQL Server let&#8217;s make sure you meet the following requirements:</p>
<ol>
<li>SSIS designer installed. Sometimes it is referred as BIDS or SSDT (<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><a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener"><em>ZappySys SSIS PowerPack</em> installed</a>. Click on the link to download a FREE trial.</li>
<li>You have basic familiarity with REST API concepts and Google BigQuery API. This post uses <a href="https://cloud.google.com/bigquery/public-data/" target="_blank" rel="noopener">free Public Dataset</a> to query BigQuery table so <em>no billing</em> is required to get your hands dirty 🙂 However, if you like to query your own dataset then make sure you have at least one BigQuery dataset and one table with some sample data created (this part <em>does require</em> billing enabled). Read a <a href="https://cloud.google.com/bigquery/quickstart-web-ui" target="_blank" rel="noopener">Google Quickstart article</a> for more information on how to create a new BigQuery dataset and a table.</li>
</ol>
<h2>Understanding Google BigQuery Object Heirarchy</h2>
<p>Google BigQuery has 3 main concepts below.</p>
<ul style="list-style-type: circle;">
<li>Project
<ul style="list-style-type: circle;">
<li>Dataset
<ul style="list-style-type: circle;">
<li>Table
<ul style="list-style-type: circle;">
<li>Query requests (each query creates a unique JobID &#8211; valid for 24 hours from which you can read data)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>So in order to create BigQuery table you always need Project and then Dataset under that project. You can group objects around Project / Datasets. When you query you can supply fully qualified name of your table in FROM clause (e.g. <pre class="crayon-plain-tag">select count(*) from `bigquery-public-data.usa_names.usa_1910_2013`</pre>  Here <strong>bigquery-public-data</strong> is project name, <strong>usa_names</strong> is dataset and <strong>usa_1910_2013</strong>  is table). So lets get started with Read operation first and then we will cover write operation. For Read operation we will use public dataset so we can quickly show you demo without too many steps but later we will cover how to automate create / delete of Dataset / Tables using API calls.</p>
<p>So let&#8217;s get started.</p>
<h2>Read data from Google BigQuery using SSIS</h2>
<p>Basically you can query Google BigQuery data in two ways: In this article we will not cover 2nd method.</p>
<ul>
<li><strong>Method-1</strong>: Query data using <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener"><em>jobs/query</em> method in BigQuery API</a>. Use it if you expect to get a result in a fairly short amount of time. This API method generates a temp table which gets deleted after 24 hours. You can read data within that time frame using newly created <em>JobId</em> reference.<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;"><strong>NOTE:</strong> If you have records that sum up to more than 10MB of data or ~10,000 rows (assuming 1 row uses 1KB of data) then you need to proceed with two-step process as explained below.</div></div></li>
<li><strong>Method-2</strong>: Export SQL query result using <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/insert" target="_blank" rel="noopener"><em>jobs/insert</em> method in BigQuery API</a>. Use this method if you expect a query to take a long time to finish.</li>
</ul>
<p>Now let&#8217;s see how to query Google BigQuery data using SSIS 🙂</p>
<h3>Create Google API Project and Register OAuth App</h3>
<p>To use any <a href="https://developers.google.com/apis-explorer/#p/" target="_blank" rel="noopener">Google API</a> firstly you have to finish two tasks:</p>
<ol>
<li><a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">Create Google API Project</a> and obtain projectId (see next section).</li>
<li><a href="https://console.cloud.google.com/apis/library/bigquery.googleapis.com" target="_blank" rel="noopener">Enable BigQuery API</a></li>
<li>Register your own Google OAuth App and obtain <strong>ClientId</strong> and <strong>Client Secret</strong>.</li>
</ol>
<p>Check step-by-step instructions on <a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">how to create Google API Project and create OAuth App for Google</a>. During instructions make sure you enable BigQuery API (screenshots may differ).</p>
<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;">NOTE: For BigQuery API you must use custom app option on OAuth connection. Google used to allow Default App but recent policy changes requires BigQuery to use Custom App to obtain your own ClientId and Client Secret (Some old Screenshots may use Default App for time being so please adjust your settings to use Custom App)</div></div>
<h3>Get Google API Project ID</h3>
<p>Once you have Google API Project created you can grab <a href="https://console.cloud.google.com/project?_ga=1.106484547.1991223081.1500069328">Project ID</a> (see screenshot below). You will need Project ID in the next step when building API URL.</p>
<div id="attachment_1567" style="width: 583px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1567" class="size-full wp-image-1567" src="//zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png" alt="How to find Google API Project ID" width="573" height="379" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png 573w, https://zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id-300x198.png 300w" sizes="(max-width: 573px) 100vw, 573px" /></a><p id="caption-attachment-1567" class="wp-caption-text">How to find Google API Project ID?</p></div>
<h3>Configure OAuth Connection for Google BigQuery API</h3>
<p>In order to call most of Google APIs you will need an OAuth App. If you want to use your own app then refer to <a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">how to register Google OAuth Application (Get ClientID and ClientSecret)</a> article. For simplicity we will use <em>Default OAuth App</em>:</p>
<ol style="margin-left: 0;">
<li>Right click inside Connection Managers area and click &#8220;New Connection&#8230;&#8221;</li>
<li>From the connection type list select &#8220;ZS-OAUTH&#8221; connection type.
<div id="attachment_1569" style="width: 687px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1569" class="size-full wp-image-1569" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png" alt="Create new SSIS OAuth API Connection Manager" width="677" height="220" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection.png 677w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-oauth-create-new-connection-300x97.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a><p id="caption-attachment-1569" class="wp-caption-text">Create new SSIS OAuth API Connection Manager</p></div></li>
<li>For OAuth Provider select &#8220;Google&#8221;.</li>
<li>For OAuth App type options leave &#8220;Use Default OAuth App&#8221; selected. If you <a href="//zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">created custom OAuth App</a> then you would need to select &#8220;Use Custom OAuth App&#8221; option.</li>
<li>For Scopes enter or select the following URLs (URL is just a permission name). Each URL must be in a separate line. For demo purposes we use only the first 3 scopes but we included a few more in case you like to test API in depth with a different permission set:<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/bigquery
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/cloud-platform.read-only
https://www.googleapis.com/auth/bigquery.insertdata
https://www.googleapis.com/auth/devstorage.full_control
https://www.googleapis.com/auth/devstorage.read_only
https://www.googleapis.com/auth/devstorage.read_write</pre>
</li>
<li>Click Generate Token. Login using correct account if needed and then you will be prompted to click &#8220;Approve&#8221; OAuth App.</li>
<li>Once you click OK on the login screen you will see new tokens populated on the connection screen.</li>
<li>Click Test to make sure connection / tokens are valid and then click OK to save the connection.<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> Below screenshot uses Default App but we recommend you to to use Custom OAuth App (Your own Clientid / secret &#8211; Obtained in previous section)</div></div>
<div id="attachment_1568" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1568" class="size-full wp-image-1568" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection.png" alt="Create SSIS OAuth API Connection for Google BigQuery API" width="675" height="654" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-integration-oauth-api-connection-300x291.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-1568" class="wp-caption-text">Create SSIS OAuth API Connection for Google BigQuery API</p></div></li>
</ol>
<h3>Start BigQuery Job and get JobId (Submit Query)</h3>
<p>Once you have SSIS OAuth connection created for BigQuery API it&#8217;s time to read data from BigQuery. So, basically, there are two ways you can read BigQuery data: using <em>query </em>or <em>insert </em>method. For demo purposes we will use <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener"><em>jobs/query</em> method</a>. If you want fire complex queries which can run for many minutes then refer to <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/insert" target="_blank" rel="noopener"><em>jobs/insert</em> method</a>.</p>
<p>If you are expecting more than 10MB of data (~10K records) then you have to split data extract in two steps:</p>
<ol>
<li>Step-1 : Call <em>jobs/query</em> method using REST API Task to submit SQL query. This steps returns <strong>jobComplete: true</strong> if supplied query execution is done within timeoutMs parameter you included. By default its 10 seconds so if your query is going to take longer than 10 seconds then its good idea to add bigger timeout that way you dont need <strong>step#2</strong>. Once API call is done you will Get JobId in the response. Save that JobId in a variable for later use. This job result is valid for 24-hours only.</li>
<li>Step-2 <strong>(Optional)</strong> &#8211; You can add another optional <strong>REST API Task</strong> after previous step to Wait until Job is completed. For simplicity, this article will Omit setting up Status Check but its very simple&#8230;.Use below settings
<ol>
<li>Drag new REST API Task from toolbox. Connect it to Step-1 and double click to configure as below.</li>
<li>Select URL From Connection mode,</li>
<li>Select OAuth connection</li>
<li>Enter URL as <strong>https://www.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/jobs/{{User::JobId}}</strong> , Method: <strong>GET</strong></li>
<li>On Response Settings Tab, Select Response Content Type <strong>JSON</strong> and for content filter enter <strong>$.status.state</strong></li>
<li>On Status Check Tab, check Enable Status Check Loop and enter <strong>DONE</strong> in SuccessValue field</li>
<li>Doing this setup will make sure we do not query data until Job Status is DONE (System keeps checking every 5 seconds)</li>
</ol>
</li>
<li>Step-2 : Read Job result using JSON Source in a Data Flow Task.</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;"><strong>NOTE</strong> : If you are expecting less than ~10K rows then you can skip this step and just go to the next section &#8211; <a href="#Read_BigQuery_SQL_result_Method1_or_Method2">Read BigQuery SQL result (Method#1 or Method#2)</a>.</div></div>
<p>Now lets see how to configure REST API Task to submit query and extract JobId (which will be used in next section).</p>
<ol style="margin-left: 0;">
<li>In the Control Flow designer drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS REST API Task</a> from the SSIS toolbox.</li>
<li>Double click the task to configure it.</li>
<li>Change Request URL Access Mode to [Url from connection].</li>
<li>From the connection dropdown select OAuth connection created in the previous section.</li>
<li>Enter URL as below (replace YOUR-PROJECT-ID with a valid Project ID obtained in the previous section):<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/YOUR-PROJECT-ID/queries</pre>
</li>
<li>Select Method as POST.</li>
<li>Enter Body (Request Data) as below (change your query if needed; we used Public dataset for the demo): If you do not specify timeout then default is 10 seconds only. Also in this call we only care about JobID from response so we just added maxResults=10 because in 2nd step we will get all rows by doing pagination.<br />
<pre class="crayon-plain-tag">{
   "timeoutMs": 100000, 
   "maxResults": 10, 
   "query": "SELECT title id,language,wp_namespace,reversion_id ,comment ,num_characters FROM [bigquery-public-data:samples.wikipedia] LIMIT 100000"
}</pre>
To use a <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/" target="_blank" rel="noopener">Standard SQL</a> query instead of <a href="https://cloud.google.com/bigquery/docs/reference/legacy-sql" target="_blank" rel="noopener">Legacy SQL</a>, add <strong>useLegacySql</strong> property and set it to <strong>false</strong>:<br />
<pre class="crayon-plain-tag">{
   "timeoutMs": 100000, 
   "maxResults": 10, 
   "query": "SELECT title id,language,wp_namespace,reversion_id ,comment ,num_characters FROM [bigquery-public-data:samples.wikipedia] LIMIT 100000",
   "useLegacySql": false
}</pre>
For all possible parameters refer to <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener"><em>jobs/query</em> method documentation</a>.</p>
<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> You can also supply location Parameter in the Body JSON to indicate where job should run. For non EU / US datacenters we suggest you to supply this parameter. See details at <a href="https://cloud.google.com/bigquery/docs/locations#specifying_your_location" target="_blank" rel="noopener">https://cloud.google.com/bigquery/docs/locations#specifying_your_location</a>.<br />
Example Use Of Location<br />
<pre class="crayon-plain-tag">{ &quot;location&quot;:&quot;us-east1&quot;,&nbsp; &quot;maxResults&quot;: 10, &quot;query&quot;: &quot;SELECT title FROM [bigquery-public-data:samples.wikipedia] LIMIT 10&quot; }</pre>
</div></div></li>
<li>Select Body Content Type as <strong>application/json</strong>.</li>
<li>Click Test Request/Response. If things go well you will see JSON content. Then just <strong>copy JobId from the response</strong> and save for later use:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2213" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid.png" alt="" width="677" height="488" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid.png 677w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-rest-api-get-jobid-300x216.png 300w" sizes="(max-width: 677px) 100vw, 677px" /></a></li>
<li>Now go to Response Settings tab.</li>
<li>Select ContentType=Json.</li>
<li>Enter below expression to extract JobId from the response. You will need this Id to read SQL query output (this JobId is valid for 24 hrs):<br />
<pre class="crayon-plain-tag">$.jobReference.jobId</pre>
</li>
<li>Choose save response content to save to a variable. Select &lt;New Variable&#8230;&gt; option. When prompted give a name to your variable (i.e. vJobId) and for the value field paste JobId copied from the above step:<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable.png"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-2214" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable.png" alt="" width="625" height="531" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable.png 625w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-response-save-json-value-variable-300x255.png 300w" sizes="(max-width: 625px) 100vw, 625px" /></a><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;"><strong>NOTE</strong>: This JobId expires after 24-hrs so while you are designing a package and not running it then design time value is used for testing/previewing. So make sure your JobId is valid. If needed click Test Request/Response to grab a new JobId and update the variable with a new value so you can preview data without running a full package.</div></div></li>
<li>Click OK to save the UI.</li>
</ol>
<h3>Read BigQuery SQL result (for specified JobID)</h3>
<p>Now let&#8217;s look at how to read data from BigQuery</p>
<p>Configure Google BigQuery Web Request (URL, Method, ContentType, Body etc.)</p>
<ol>
<li>In the Control Flow designer drag and drop 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>Double click Data Flow Task and drag and drop <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">ZS JSON Source (For API/File)</a> from SSIS toolbox.<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 to edit and configure as below</li>
<li>Enter URL as below. Replace <strong>YOUR-API-PROJECT-ID</strong> with the API Project ID obtained in the <a href="//zappysys.com/blog/wp-content/uploads/2017/07/how-to-find-google-api-project-id.png" target="_blank" rel="noopener">previous section</a>.<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/YOUR-API-PROJECT-ID/queries/{{User::vJobId}}?maxResults=10000</pre>
&#8211;OR&#8211; (Use below if your Job ran <strong>outside US / EU data center</strong>)<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/YOUR-API-PROJECT-ID/queries/{{User::vJobId}}?location=YOUR_REGION_ID&amp;maxResults=10000</pre>
<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> location Parameter indicates the geographic location of the job. This is <span style="text-decoration: underline;"><strong>Required parameter except for US and EU</strong></span>. See details at <a href="https://cloud.google.com/bigquery/docs/locations#specifying_your_location">https://cloud.google.com/bigquery/docs/locations#specifying_your_location</a>. You can supply same location parameter for first step when you <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener">submit the query</a></p>
<p>Failure to supply location parameter for non US /EU users may result in <strong>404 NotFound Error</strong>.<br />
</div></div></li>
<li>Check <strong>Use Credentials</strong> option and select <strong>OAuth Connection Manager</strong> created in the previous section.</li>
<li>For HTTP Request Method select <strong>GET</strong>.<br />
<a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source.png"><img loading="lazy" decoding="async" class="size-full wp-image-2215" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source.png" alt="Read data from Google BigQuery from Temp Job result" width="1004" height="661" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source.png 1004w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source-300x198.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-read-data-from-google-bigquery-job-use-json-source-768x506.png 768w" sizes="(max-width: 1004px) 100vw, 1004px" /></a></li>
</ol>
<p>Read data from Google BigQuery from Temp Job result</p>
<h4>Configure Filter</h4>
<p>We need to transform a single JSON response into multiple rows so we need to apply a correct filter.</p>
<ol>
<li>On JSON Source go to Filter Options tab.</li>
<li>In the Filter field enter<strong> $.rows[*]</strong> or click [Select Filter] button to browse hierarchy you want to extract.</li>
</ol>
<div id="attachment_1573" style="width: 685px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1573" class="wp-image-1573 size-full" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png" alt="Select Filter for JSON Response" width="675" height="363" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter.png 675w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-get-data-google-bigquery-select-json-filter-300x161.png 300w" sizes="(max-width: 675px) 100vw, 675px" /></a><p id="caption-attachment-1573" class="wp-caption-text">Select Filter for JSON Response</p></div>
<h4>Configure BigQuery API Pagination Settings</h4>
<p>Most of modern APIs usually implement some sort of pagination technique so you get a part of data in each request rather than all in one go. Thus if you want more you can paginate through pages until the last page is reached. You can also read <a href="//zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">Understanding REST API Pagination in SSIS</a> article to learn more about pagination in SSIS.</p>
<p>BigQuery API returns <em>pageToken</em> attribute in response JSON if more data is found for requested query result. You can then pass <em>pageToken</em> in the next URL in this format: <strong>http://my-api-url/?pageToken=xxxxxxxxxx</strong></p>
<p>Now lets configure JSON Source to automate this pagination for us. On JSON Source go to Pagination Tab and enter the following two settings:</p>
<ol>
<li>Set Next Link as <strong>$.pageToken</strong>.</li>
<li>Set Suffix for Next URL as <strong>&amp;pageToken=&lt;%nextlink%&gt;</strong>.</li>
</ol>
<p>See the screenshot below to get more clarity:</p>
<div id="attachment_1572" style="width: 815px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1572" class="size-full wp-image-1572" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings.png" alt="Configure BigQuery API Pagination on SSIS JSON Source" width="805" height="576" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings.png 805w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings-300x215.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-api-pagination-settings-768x550.png 768w" sizes="(max-width: 805px) 100vw, 805px" /></a><p id="caption-attachment-1572" class="wp-caption-text">Configure BigQuery API Pagination on SSIS JSON Source</p></div>
<h4>Configure Array Transformation</h4>
<p>Now the last thing we have to configure is special 2-dimensional JSON array format used by BigQuery API:</p>
<ol>
<li>On the JSON Source UI go to 2D Array Transformation tab.</li>
<li>Enter the following settings:
<ol>
<li>For Transformation Type select <strong>Transform complex 2-dimensional array</strong>.</li>
<li>For Column Name filter enter <strong>$.schema.fields[*].name</strong>.</li>
<li>For Row Values Filter enter <strong>$.f[*].v</strong>.</li>
</ol>
</li>
</ol>
<div id="attachment_1575" style="width: 819px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1575" class="size-full wp-image-1575" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery.png" alt="JSON Array Transformation Options" width="809" height="317" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery.png 809w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery-300x118.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-filter-extract-2d-array-get-data-from-google-bigquery-768x301.png 768w" sizes="(max-width: 809px) 100vw, 809px" /></a><p id="caption-attachment-1575" class="wp-caption-text">JSON Array Transformation Options</p></div>
<h4>Preview Data and Save UI</h4>
<p>That&#8217;s it click Preview to see some data. If you entered sample JobID for your User::vJobID variable then you will see some data. In the next section we will see how to load Google BigQuery data into SQL Server. You can click Columns Tab to review Metadata.</p>
<p>Click OK to save UI and generate Metadata.</p>
<p>&nbsp;</p>
<h3>Configure Target &#8211; Load Google BigQuery data into SQL Server</h3>
<p>Now you can connect your JSON Source to any target such as ZS Trash Destination or a real database destination such as OLEDB Destination.</p>
<p>If you wish to dump data from Google BigQuery to a SQL Server table then just perform the following steps:</p>
<ol>
<li>Drag and drop OLEDB Destination from SSIS Toolbox. Rename it to something like SQL Server Table.</li>
<li>Double click on OLEDB Destination.</li>
<li>Click New to create a new connection &gt; Configure connection &gt; Click OK.</li>
<li>Click on New to create a new table &gt; Rename default table name &gt; Click OK.</li>
<li>Click on Mappings tab and click OK to save UI with default mappings.</li>
</ol>
<div id="attachment_1580" style="width: 918px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1580" class="size-full wp-image-1580" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector.png" alt="Configure SSIS OLEDB Destination - Google BigQuery to SQL Server Import" width="908" height="558" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector.png 908w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector-300x184.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-load-data-google-bigquery-to-sqlserver-table-json-connector-768x472.png 768w" sizes="(max-width: 908px) 100vw, 908px" /></a><p id="caption-attachment-1580" class="wp-caption-text">Configure SSIS OLEDB Destination &#8211; Google BigQuery to SQL Server Import</p></div>
<h3>Execute Package &#8211; Loading BigQuery data into SQL Server</h3>
<div id="attachment_1578" style="width: 596px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1578" class="size-full wp-image-1578" src="//zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver.png" alt="SSIS Package Execution - Loading Google BigQuery Data into SQL Server" width="586" height="296" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver.png 586w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-package-execute-rest-api-loading-data-from-bigquery-to-sqlserver-300x152.png 300w" sizes="(max-width: 586px) 100vw, 586px" /></a><p id="caption-attachment-1578" class="wp-caption-text">SSIS Package Execution &#8211;<br />Loading Google BigQuery Data into SQL Server</p></div>
<h2>Create / Delete Google BigQuery Dataset using API call</h2>
<p>As we mentioned before, you need dataset before you can create a table. Most common way to create dataset is via User Interface but what if you like to automate from your SSIS Package or other workflow? Here is how you can create or delete. Basically you can use REST API Task to send CREATE or DROP command for Dataset object</p>
<h3><strong>Create Google Dataset</strong></h3>
<p>To create dataset configure REST API Task using below settings (We will <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/insert" target="_blank" rel="noopener">call this API</a>)</p>
<ol>
<li>Drag REST API Task from toolbox<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>Select URL from Connection mode and select connection as <strong>OAuth connection</strong> (Created in previous section)</li>
<li>Enter below URL (assuming you stored your ProjectID in a variable called ProjectId<br />
<pre class="crayon-plain-tag">https://bigquery.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/datasets</pre>
</li>
<li>Request Method as <strong>POST</strong></li>
<li>Enter Request Body as below (change YOUR_DATASET_NAME &#8211; e.g. TestDataset )<br />
<pre class="crayon-plain-tag">{"datasetReference": { "datasetId": "YOUR_DATASET_NAME", "projectId": "{{User::ProjectId}}"} }</pre>
</li>
<li>Select Request Content Type as <strong>application/json</strong> from the dropdown</li>
<li>(Optional) &#8211; If you want to implement Continue if Dataset already exists then you can go to Error Handling Tab (See next section for screenshot) and check <strong>Continue On Error Code</strong> option and set <strong>409 status code</strong></li>
<li>That&#8217;s it. Click Test Request/Response see it works.</li>
</ol>
<h3>Delete Google BigQuery Dataset</h3>
<p>For deleing dataset you have to choose same steps as above except two things</p>
<ol>
<li>Request Method as <strong>DELETE</strong></li>
<li>Request Body as blank</li>
</ol>
<h2>Create / Delete Google BigQuery Table using API call</h2>
<p>Now let&#8217;s look at how to create /drop Table in Google BigQuery using API calls.</p>
<h3>Create Google BigQuery Table</h3>
<p>To send <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#:~:text=%20%20%201%20Open%20the%20BigQuery%20web,table%20appears%20in%20the%20resources%20pane.%20More%20" target="_blank" rel="noopener">CREATE TABLE  SQL statement (DDL)</a> we have to use same approach as we send normal SQL Query <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener">using this API call</a>. So notice we used Standard SQL for this call by supplying  <strong>useLegacySql: false</strong> . DDL Statement must be all in one line</p><pre class="crayon-plain-tag">POST https://www.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/queries

Content-Type: application/json

&gt;&gt;&gt;&gt; BODY &lt;&lt;&lt;&lt;&lt;

{
 "query": "CREATE TABLE TestDataset.Table1 (RecordID INT64,CustomerID STRING,CustomerName STRING);",
 "useLegacySql": false,
 "timeoutMs": 100000 
}</pre><p>
To create dataset configure REST API Task using below settings</p>
<ol>
<li>Drag REST API Task from toolbox<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>Select URL from Connection mode and select connection as <strong>OAuth connection</strong> (Created in previous section)</li>
<li>Enter below URL (assuming you stored your ProjectID in a variable called ProjectId<br />
<pre class="crayon-plain-tag">https://bigquery.googleapis.com/bigquery/v2/projects/{{User::ProjectId}}/queries</pre>
</li>
<li>Request Method as <strong>POST</strong></li>
<li>Enter Request Body as below<br />
<pre class="crayon-plain-tag">{
 "query": "CREATE TABLE TestDataset.Table1 (RecordID INT64,CustomerID STRING,CustomerName STRING);",
 "useLegacySql": false,
 "timeoutMs": 100000
}</pre>
</li>
<li>Select Request Content Type as <strong>application/json</strong> from the dropdown</li>
<li>(Optional) &#8211; If you want to implement Continue if Table exists then you can go to enable Error Handling Tab and check <strong>Continue On Error Code</strong> option and set <strong>409 status code</strong></li>
<li>That&#8217;s it. Click Test Request/Response see it works.</li>
</ol>
<div id="attachment_8986" style="width: 1008px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8986" class="size-full wp-image-8986" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists.png" alt="Create Google BigQuery Table - API Call (Continue On Error Setting - Skip CREATE if Table / Dataset Already Exists)" width="998" height="692" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists.png 998w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists-300x208.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-create-bigquery-table-rest-api-call-skip-if-exists-768x533.png 768w" sizes="(max-width: 998px) 100vw, 998px" /></a><p id="caption-attachment-8986" class="wp-caption-text">Create Google BigQuery Table &#8211; API Call (Continue On Error Setting &#8211; Skip CREATE if Table / Dataset Already Exists)</p></div>
<h3>Delete Google BigQuery Table</h3>
<p>For deleing table you have to choose same steps as above except two things</p>
<ol>
<li>Request Method as <strong>DELETE</strong></li>
<li>Request Body as blank</li>
</ol>
<h2>Write data to Google BigQuery using SSIS &#8211; 1 Million row insert test (FAST)</h2>
<p>Now let&#8217;s look at how easy it is to import data into Google BigQuery using SSIS. We will use the same OAuth connection we created before. To learn more about inserting data into BigQuery check <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll"><i>tabledata/insertAll </i>method documentation</a>.</p>
<h3>Make sure billing is enabled</h3>
<p>Make sure that billing is enabled for your Google Cloud project. <a href="https://cloud.google.com/billing/docs/how-to/modify-project" target="_blank" rel="noopener">Learn how to confirm billing is enabled for your project</a>.</p>
<p>Streaming is not available via the <a href="https://cloud.google.com/bigquery/pricing#free-tier">free tier</a>. If you attempt to use streaming without enabling billing, you receive the following error: <code translate="no" dir="ltr">BigQuery: Streaming insert is not allowed in the free tier.</code></p>
<p>As long as your API calls fall under Free Tier  limit you wont be charged but you still need to enable billing if you wish to call Streaming insertAll API call (Write  demo).</p>
<h3>Configure OAuth Connection / Permissions</h3>
<p>If you want to perform data insert operation in BigQuery using API calls then include the following scopes in your OAuth Connection Manager and generate a token (see our first section of this article &#8211; We already included scopes for Write operation but incase you didnt do then regenerate token with below scopes):</p><pre class="crayon-plain-tag">https://www.googleapis.com/auth/bigquery
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/bigquery.insertdata</pre><p>
<h3>Create BigQuery Dataset (From UI)</h3>
<p>For this demo first create a test dataset and one table under it like shown below (<em>billing must be enabled on your Google API Project</em>). To do that go to <a href="https://bigquery.cloud.google.com/welcome" target="_blank" rel="noopener">https://bigquery.cloud.google.com/welcome</a> and configure them:</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> BigQuery now provides a <a href="https://cloud.google.com/bigquery/docs/sandbox">sandbox</a> if you do not want to provide a credit card or enable billing for your project. The steps in this topic work for a project whether or not your project has billing enabled. If you optionally want to enable billing, see <a href="https://cloud.google.com/billing/docs/how-to/modify-project" target="_blank" rel="noopener">Learn how to enable billing</a>. There are some restriction on Sandbox mode (Write API calls will fail &#8211; Check Common Errors section later this article)</div></div>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination.png"><img loading="lazy" decoding="async" class="size-full wp-image-2354" src="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination.png" alt="Create sample dataset and table for Google BigQuery Load" width="715" height="599" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination.png 715w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-console-create-dataset-table-defination-300x251.png 300w" sizes="(max-width: 715px) 100vw, 715px" /></a></p>
<h3>Insert data into BigQuery using API call</h3>
<p>And here is a REST API example to insert data into a BigQuery Table:</p>
<p><strong>Request URL:</strong></p><pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/MY_PROJECT_ID/datasets/MY_DATASET_ID/tables/MY_TABLE_ID/insertAll</pre><p>
<strong>Request Headers:</strong></p><pre class="crayon-plain-tag">Authorization: Bearer ya29.Gl0cBxxxxxxxxxxxxxxxxxxuEIhJIEnxE6GsQPHI
Content-Type: application/json</pre><p>
<strong>Request Body:</strong></p><pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllRequest",
  "rows": [
     {"json": {"RowId": 1,"CustomerName": "AAA"} }, 
     {"json": {"RowId": 2,"CustomerName": "BBB"} }
   ]
}</pre><p>
<h3></h3>
<p>Here is our data flow setup to achive very high throughput for Google BigQuery Data Load. We will show you how to insert one million rows in Google BigQuery in less than a minute based on below setup. We will use Multi Threading option and New Compression Option (Added in v3.1.4)</p>
<ol>
<li>Dummy Data Source &#8211; Generate sample records</li>
<li>JSON Generator Transform &#8211; Generates JSON documents to send as POST request for above /insertAll API call.</li>
<li>Web API destination  &#8211; Call /insertAll API call to submit our data to BigQuery</li>
<li><strong>(Optional)</strong> JSON Parser Transform &#8211; Parse Error Message for any response</li>
<li><strong>(Optional)</strong> Trash Destination &#8211; Save any errors to text file for review</li>
</ol>
<div id="attachment_8973" style="width: 910px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8973" class="size-full wp-image-8973" src="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on.png" alt="Google BigQuery Data Load Demo in SSIS - 1 Million Rows Insert with Multi Threads and Compression ON (Fast Upload)" width="900" height="724" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on.png 900w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on-300x241.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/google-bigquery-fast-data-load-ssis-multi-threads-insert-compression-on-768x618.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></a><p id="caption-attachment-8973" class="wp-caption-text">Google BigQuery Data Load Demo in SSIS &#8211; 1 Million Rows Insert with Multi Threads and Compression ON (Fast Upload)</p></div>
<p>&nbsp;</p>
<h3>Configure SSIS JSON Generator &#8211; Generate JSON for BigQuery Table Insert</h3>
<p>Now let&#8217;s see how to build an HTTP request with JSON body and send it to BigQuery:</p>
<ol style="margin-left: 0;">
<li>Drag Data Flow Task and double click on it.<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 and configure your Source (for this demo we use Dummy Data Source with Customer Template). See previous section for configuration of Dummy Data Source.<br />
<img decoding="async" class="figureimage" title="SSIS DummyData Source - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/dummy-data-Source/ssis-dummy-data-source-adapter-drag.png" alt="SSIS DummyData Source - Drag and Drop" /></li>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-generator-transform/" target="_blank" rel="noopener">ZS JSON Generator Transform</a> to produce JSON from a database or file records. If your source is already sending a valid JSON then you can skip this step (e.g. SQL query is<br />
returning JSON). You can also read raw JSON from a very large file (new-line separated JSON) using <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source with Output as Raw Data</a> option checked.<img decoding="async" class="figureimage" title="SSIS JSON Generator - Drag and Drop" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/json-generator-transform/ssis-json-generator-transform-drag-2.png" alt="SSIS JSON Generator - Drag and Drop" /></li>
<li>Connect Source to JSON Generator. Double click JSON Generator Transform to start configuring it like below.</li>
<li>Select Output Mode as <strong>Single Dataset Array</strong> and enter Batch Size <strong>10000</strong> (This is Max limit allowed by Google BigQuery API <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertAll" target="_blank" rel="noopener">insertAll</a>)</li>
<li>First <strong>right click</strong> on Mappings node and select <strong>Add Static Element</strong>
<div id="attachment_8975" style="width: 862px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8975" class="size-full wp-image-8975" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate.png" alt="Generate JSON for Google BigQuery InsertAll API request - Batch 10000 rows in a single API call" width="852" height="391" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate.png 852w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate-300x138.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-insert-request-batch-json-generate-768x352.png 768w" sizes="(max-width: 852px) 100vw, 852px" /></a><p id="caption-attachment-8975" class="wp-caption-text">Generate JSON for Google BigQuery InsertAll API request &#8211; Batch 10000 rows in a single API call</p></div></li>
<li>Enter Name as <strong>kind</strong> and value as <strong><strong>bigquery#tableDataInsertAllRequest<br />
</strong></strong></p>
<div id="attachment_8976" style="width: 538px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8976" class="size-full wp-image-8976" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value.png" alt="JSON Generator - Add Static Element" width="528" height="373" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value.png 528w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-static-value-300x212.png 300w" sizes="(max-width: 528px) 100vw, 528px" /></a><p id="caption-attachment-8976" class="wp-caption-text">JSON Generator &#8211; Add Static Element</p></div></li>
<li>Now right click on Mappings node and select <strong>Add Document Array</strong> option
<div id="attachment_8978" style="width: 464px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8978" class="wp-image-8978 size-full" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option.png" alt="JSON Generator - Add Document Array" width="454" height="349" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option.png 454w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-option-300x231.png 300w" sizes="(max-width: 454px) 100vw, 454px" /></a><p id="caption-attachment-8978" class="wp-caption-text">JSON Generator &#8211; Add Document Array</p></div></li>
<li>Enter <strong>rows</strong> as array title and click OK
<div id="attachment_8979" style="width: 470px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8979" class="size-full wp-image-8979" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array.png" alt="JSON Generator - Name array" width="460" height="313" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array.png 460w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-document-array-300x204.png 300w" sizes="(max-width: 460px) 100vw, 460px" /></a><p id="caption-attachment-8979" class="wp-caption-text">JSON Generator &#8211; Name array</p></div></li>
<li>Select newly added array node and right click &gt; Add <strong>unbound nested element</strong>  enter Output alias as <strong>json </strong>and click OK.
<div id="attachment_8980" style="width: 475px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8980" class="size-full wp-image-8980" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element.png" alt="JSON Generator - Add unbound nested element" width="465" height="471" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element.png 465w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-unbound-element-296x300.png 296w" sizes="(max-width: 465px) 100vw, 465px" /></a><p id="caption-attachment-8980" class="wp-caption-text">JSON Generator &#8211; Add unbound nested element</p></div></li>
<li>Select <strong>json</strong> node and right click &gt; Select <strong>Add Elements below</strong> this node and select multiple columns you like to send to BigQuery. Click OK to save.
<div id="attachment_8981" style="width: 467px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8981" class="size-full wp-image-8981" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements.png" alt="JSON Generator - Add Multiple Elements" width="457" height="529" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements.png 457w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-json-generator-add-multiple-elements-259x300.png 259w" sizes="(max-width: 457px) 100vw, 457px" /></a><p id="caption-attachment-8981" class="wp-caption-text">JSON Generator &#8211; Add Multiple Elements</p></div></li>
<li>Now let&#8217;s preview our JSON (Copy preview JSON to try in the next step &#8211; Web API destination)<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;">NOTE: Table name and column names are case-sensitive so make sure your JSON attribute matches exact same way. </div></div>Here is the finished JSON Structure for next Step
<div id="attachment_8982" style="width: 857px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8982" class="size-full wp-image-8982" src="https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api.png" alt="Sample JSON Request body for Google BigQuery insertAll API request" width="847" height="671" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api.png 847w, https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api-300x238.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/create-google-bigquery-request-json-insertall-api-768x608.png 768w" sizes="(max-width: 847px) 100vw, 847px" /></a><p id="caption-attachment-8982" class="wp-caption-text">Sample JSON Request body for Google BigQuery insertAll API request</p></div></li>
<li>Click OK to save UI.</li>
</ol>
<h3>Configure SSIS Web API destination &#8211; Insert data into BigQuery Table</h3>
<p>Once you have Input JSON prepared,  now let&#8217;s configure destination for BigQuery.</p>
<ol style="margin-left: 0;">
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">ZS Web API Destination</a>.</li>
<li>Connect your JSON Generator Transform to Web API destination.</li>
<li>Configure general properties:
<div id="attachment_2349" style="width: 869px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2349" class="size-full wp-image-2349" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination.png" alt="SSIS Web API Destination - Configure for BigQuery Data load" width="859" height="583" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination.png 859w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination-300x204.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-load-using-web-api-destination-768x521.png 768w" sizes="(max-width: 859px) 100vw, 859px" /></a><p id="caption-attachment-2349" class="wp-caption-text">SSIS Web API Destination &#8211;<br />Configure for BigQuery Data load</p></div></li>
<li>Make sure to enter URL in this format:<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/bigquery/v2/projects/MY_PROJECT_ID/datasets/MY_DATASET_ID/tables/MY_TABLE_ID/insertAll</pre>
Make sure to replace 3 parts in above URL (MY_PROJECT_ID, MY_DATASET_ID, MY_TABLE_ID) with actual values from your Google Project and BigQuery dataset/table configuration.</li>
<li>Now you can enable Compression and Multiple Threads for higher throughput as below.<br />
<strong>NOTE:</strong> Compression Property was added in v3.1.4 so you may not see it if you have older version.</p>
<div id="attachment_8983" style="width: 1042px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8983" class="size-full wp-image-8983" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads.png" alt="Google BigQuery Data Loading Performance Optimization Options - Enable Multiple Threads and Compression Options" width="1032" height="347" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads.png 1032w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads-300x101.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads-768x258.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-rest-api-post-data-request-performance-optimization-gzip-compression-multi-threads-1024x344.png 1024w" sizes="(max-width: 1032px) 100vw, 1032px" /></a><p id="caption-attachment-8983" class="wp-caption-text">Google BigQuery Data Loading Performance Optimization Options &#8211; Enable Multiple Threads and Compression Options</p></div></li>
<li>If you want to try test insert request from UI without running full package then go back to first tab and edit Body (Use Sample JSON generated by previous JSON Transform &#8211; You can grab from JSON Preview Panel on Generator Transform).Click Test Request / Response and confirm Success as below. You can go back to your BigQuery Portal and check one row is inserted after our test click. If everything looking good then run full package to insert all records.Sample JSON for Body:<br />
<pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllRequest",
  "rows": [
     {"json": {"RowId": 1,"CustomerName": "AAA"} }, 
     {"json": {"RowId": 2,"CustomerName": "BBB"} }
   ]
}</pre>
<div id="attachment_4919" style="width: 910px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4919" class="size-full wp-image-4919" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api.png" alt="Test Google BigQuery Table Insert - SSIS Web API Destination UI" width="900" height="730" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api.png 900w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api-300x243.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-google-bigquery-test-insert-dataset-record-api-768x623.png 768w" sizes="(max-width: 900px) 100vw, 900px" /></a><p id="caption-attachment-4919" class="wp-caption-text">Test Google BigQuery Table Insert &#8211; SSIS Web API Destination UI</p></div></li>
<li>Hit OK to save UI.</li>
<li>Run the package and verify data in Google BigQuery Console:
<div id="attachment_2351" style="width: 1206px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2351" class="size-full wp-image-2351" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example.png" alt="Loading data into Google BigQuery using SSIS" width="1196" height="625" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example.png 1196w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example-300x157.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example-768x401.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-example-1024x535.png 1024w" sizes="(max-width: 1196px) 100vw, 1196px" /></a><p id="caption-attachment-2351" class="wp-caption-text">Loading data into Google BigQuery using SSIS</p></div></li>
</ol>
<h2></h2>
<h2>Error Handling for BigQuery Data Load (Bulk Insert API Calls)</h2>
<p>There will be a time when some records you insert may not go well in Google BigQuery. In such case you can read output from Web API destination and parse further with JSON Parser Transform. Check for certain values in the output. You must use JSON Parser after Web API destination (Connect <strong>Blue Arrow</strong> from Web API destination &#8211; Since its Soft Error it won&#8217;t redirect in Red Arrow ).</p>
<p>For example here is the sample JSON in POST Body for testing which produces error due to bad column name. When bad row found in batch all records will be rejected. Notice that error returns index of record in batch so you can identify which row went bad. It also returns column name in location attribute.</p>
<p><strong>NOTE: Bad column name in 2nd record</strong></p>
<p><strong>Test Body (Bad):</strong></p><pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllRequest",
  "rows": [
     {"json": {"RecordID": 1,"CustomerID": "X1"} }, 
     {"json": {"Bad_Column": 2,"CustomerID": "X2"} }
     {"json": {"RecordID": 3,"CustomerID": "X3"} }, 
   ]
}</pre><p>
&nbsp;</p>
<p><strong>Response (For Bad Input):</strong></p><pre class="crayon-plain-tag">{
  "kind": "bigquery#tableDataInsertAllResponse",
  "insertErrors": [
    {
      "index": 1,
      "errors": [
        {
          "reason": "invalid",
          "location": "bad_column",
          "debugInfo": "",
          "message": "no such field."
        }
      ]
    },
    {
      "index": 0,
      "errors": [
        {
          "reason": "stopped",
          "location": "",
          "debugInfo": "",
          "message": ""
        }
      ]
    },
    {
      "index": 2,
      "errors": [
        {
          "reason": "stopped",
          "location": "",
          "debugInfo": "",
          "message": ""
        }
      ]
    }
  ]
}</pre><p>
&nbsp;</p>
<p>To configure error detection perform following steps.</p>
<ol>
<li>Drag and drop <a href="https://zappysys.com/products/ssis-powerpack/ssis-json-parser-transform/" target="_blank" rel="noopener">ZS JSON Parser Transform</a> after Web API destination</li>
<li>Click on Web API destination. Connect Blue arrow  to JSON Parser Transform</li>
<li>Configure JSON Parser Transform like below</li>
<li>Connect JSON Parser TRansform to some Destination to save error information (e.g. SQL Table or Trans destination)</li>
</ol>
<div id="attachment_4920" style="width: 1111px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-4920" class="size-full wp-image-4920" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser.png" alt="Handling BigQuery Insert Errors in SSIS " width="1101" height="739" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser.png 1101w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-300x201.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-768x515.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-1024x687.png 1024w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-handle-bigquery-insert-errors-json-parser-272x182.png 272w" sizes="(max-width: 1101px) 100vw, 1101px" /></a><p id="caption-attachment-4920" class="wp-caption-text">Handling BigQuery Insert Errors in SSIS</p></div>
<h2>Other Common Errors in BigQuery API calls</h2>
<p>In this section we will talk about many common API errors in BigQuery.</p>
<h3>Error: The project XXXXXXX has not enabled BigQuery</h3>
<p>Sometimes you might get below error. To fix this error make sure you go to your Project and <a href="https://console.cloud.google.com/apis/library/bigquery.googleapis.com" target="_blank" rel="noopener">Enable BigQuery API</a></p><pre class="crayon-plain-tag">Status Code: BadRequest

Response Body: {
  "error": {
    "code": 400,
    "message": "The project bigquerytest-281915 has not enabled BigQuery.",
    "errors": [
      {
        "message": "The project bigquerytest-281915 has not enabled BigQuery.",
        "domain": "global",
        "reason": "invalid"
      }
    ],
    "status": "INVALID_ARGUMENT"
  }
}</pre><p>
<h3>Error: 404 &#8211; Not Found: Table / Job xxxxxx</h3>
<ul>
<li>Make sure you are setting GET request and not POST.</li>
<li>Also make sure your jobId is valid because it expires after 24 hours.</li>
<li>Make sure project-id supplied in URL is valid ID  (DO NOT Specify Alias, use internal ID for project)</li>
<li>
<div>Make sure you supplied location parameter if your outside EU / US region. Reading data using <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults" target="_blank" rel="noopener">this API call</a> might fail if you failed to supply <strong>location</strong> in URL</div>
</li>
</ul>
</p><pre class="crayon-plain-tag">{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "Not Found: Table xxxxxx"
   }
  ],
  "code": 404,
  "message": "Not Found: Table xxxxxxx
 }
}</pre><p>
&nbsp;</p>
<h3>Error: 403 &#8211; Access Denied: BigQuery BigQuery: Streaming insert is not allowed in the free tier</h3>
<p>If you trying call certain APIs on sandbox mode or free tier then you might get below error. To overcome this error <a href="https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project" target="_blank" rel="noopener">enable billing on google bigquery</a>. As long as your API calls fall under Free Tier  limit you wont be charged but you still need to enable billing if you wish to call Streaming insertAll API call.</p><pre class="crayon-plain-tag">Response Url: https://www.googleapis.com/bigquery/v2/projects/bigquerytest-281915/datasets/TestDataset/tables/Table1/insertAll

Status Code: Forbidden

Response Body: {
  "error": {
    "code": 403,
    "message": "Access Denied: BigQuery BigQuery: Streaming insert is not allowed in the free tier",
    "errors": [
      {
        "message": "Access Denied: BigQuery BigQuery: Streaming insert is not allowed in the free tier",
        "domain": "global",
        "reason": "accessDenied"
      }
    ],
    "status": "PERMISSION_DENIED"
  }
}</pre><p>
&nbsp;</p>
<p>&nbsp;</p>
<h2>Debugging Web API Requests</h2>
<p>If you need to debug actual requests made to Google server then you can use a tool like <a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Fiddler</a>. It&#8217;s a very handy tool to troubleshoot JSON format issues. It will allow to see how a request is made to a server.</p>
<div id="attachment_2352" style="width: 1076px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-2352" class="size-full wp-image-2352" src="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler.png" alt="Using Fiddler to debug Google BigQuery API requests in SSIS" width="1066" height="719" srcset="https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler.png 1066w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-300x202.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-768x518.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-1024x691.png 1024w, https://zappysys.com/blog/wp-content/uploads/2017/07/ssis-bigquery-data-import-debug-api-request-using-fiddler-272x182.png 272w" sizes="(max-width: 1066px) 100vw, 1066px" /></a><p id="caption-attachment-2352" class="wp-caption-text">Using Fiddler to debug Google BigQuery API requests in SSIS</p></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>Deployment to Production</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 Sample Package</h2>
<p><a href="https://zappysys.com/blog/wp-content/uploads/2017/07/Google_BigQuery_API_Read_Write_Create_Delete_Sample_SSIS2019_2017_2012.zip">Click Here to Download SSIS Sample Package &#8211; Google BigQuery API Read Write Create Delete (SSIS 2019, 2017, 2012)</a></p>
<p>&nbsp;</p>
<h2>Conclusion. What&#8217;s next?</h2>
<p>In this article we have learned how to load data from Google BigQuery into SQL Server using SSIS (drag and drop approach without coding). We used <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS JSON / REST API Connector</a> to extract data from Google BigQuery REST API using OAuth. JSON Source Connector makes it super simple to parse complex/large JSON files or any Web API response into rows and columns so you can load data into a database, e.g. SQL Server database. <a href="//zappysys.com/products/ssis-powerpack/">Download SSIS PowerPack</a> to try many other automation scenarios that were not discussed in this article.</p>
<p><strong>Keywords:</strong></p>
<p>Google BigQuery Integration with SQL Server | How to extract data from google bigquery in SSIS? | How to read data from Google BigQuery API? | Loading BigQuery Data into SQL Server. | BigQuery to SQL Server | SSIS Google Big Query Integration | SSIS Google BigQuery Import  JSON File | SSIS Google BigQuery Export data</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/get-data-google-bigquery-using-ssis/">How to read / write data in Google BigQuery using SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>3 ways to get Google Analytics unsampled data in SSIS</title>
		<link>https://zappysys.com/blog/3-ways-get-unsampled-data-ssis-google-analytics-source/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Wed, 26 Apr 2017 17:20:45 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[SSIS Google Analytics Source]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[ssis google analytics source]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1129</guid>

					<description><![CDATA[<p>Introduction In our previous post, we saw how to get data from Google Analytics using SSIS. Once you get going with the drag and drop SSIS Google Analytics Connector, you may bump up to one interesting challenge. If your request includes sessions above a certain threshold, Google may start sampling your data to provide an average for [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/3-ways-get-unsampled-data-ssis-google-analytics-source/">3 ways to get Google Analytics unsampled data in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In our previous post, we saw <a href="https://zappysys.com/blog/get-data-from-google-analytics-in-ssis-using-rest-api-call/" target="_blank" rel="noopener">how to get data from Google Analytics using SSIS</a>. Once you get going with the <a href="//zappysys.com/products/ssis-powerpack/ssis-google-analytics-source-connector/" target="_blank" rel="noopener">drag and drop SSIS Google Analytics Connector</a>, you may bump up to one interesting challenge. If your request includes sessions above a certain threshold, Google may start sampling your data to provide an average for many Metrics. So, how do you make sure your request includes all sessions in the calculation? The following sections will describe a few ways to achieve this.</p>
<h2>Google Analytics Data Sampling Tips</h2>
<p>There is no way to guarantee 100% Unsampled data in the Standard Google Analytics API call due to restrictions imposed by Google. However, there are a few workarounds that may help you achieve a very high Data Sampling rate.</p>
<p><span style="box-sizing: border-box; margin: 0px; padding: 0px;">The most common solution is that if you set the Sampling option to HIGHER_PRECISION, then Google may honor your request up to a certain threshold, but as the dataset grows (e.g., if you select a larger date range), Google may sample your data even though you set <strong>HIGHER_PRECISION</strong>.</span></p>
<div id="attachment_11615" style="width: 648px" class="wp-caption aligncenter"><a href="https://zappysys.com/blog/wp-content/uploads/2017/04/Extract-data-from-Google-Analytics-in-SSIS-Use-Sample-Size-option-to-get-Unsampled-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11615" class="size-full wp-image-11615" src="https://zappysys.com/blog/wp-content/uploads/2017/04/Extract-data-from-Google-Analytics-in-SSIS-Use-Sample-Size-option-to-get-Unsampled-data.png" alt="" width="638" height="670" srcset="https://zappysys.com/blog/wp-content/uploads/2017/04/Extract-data-from-Google-Analytics-in-SSIS-Use-Sample-Size-option-to-get-Unsampled-data.png 638w, https://zappysys.com/blog/wp-content/uploads/2017/04/Extract-data-from-Google-Analytics-in-SSIS-Use-Sample-Size-option-to-get-Unsampled-data-286x300.png 286w" sizes="(max-width: 638px) 100vw, 638px" /></a><p id="caption-attachment-11615" class="wp-caption-text">Extract data from Google Analytics in SSIS: Use the Sample Size option to get Unsampled data.</p></div>
<h2>Other ways to get unsampled data from the Google Analytics API</h2>
<p>Now, let&#8217;s look at a few other ways if the previous approach doesn&#8217;t work.</p>
<ol>
<li>Narrow down your Date range&#8230; e.g., Process day by day rather than a full extract. If day by day is also sampling, they try Hour-by-Hour.</li>
<li>Use the Google API to generate and download Unsampled data (We don&#8217;t have an article on this, but see the reference below).</li>
<li>Use a Google Analytics 360 Premium Account with the unsampled report feature. You can get this via the Web Interface or call the API to automate the extraction. <a href="https://support.google.com/analytics/answer/2601061?hl=en" target="_blank" rel="noopener">https://support.google.com/analytics/answer/2601061?hl=en</a></li>
</ol>
<p><a href="https://developers.google.com/analytics/devguides/config/mgmt/v3/unsampled-reports" target="_blank" rel="noopener">https://developers.google.com/analytics/devguides/config/mgmt/v3/unsampled-reports</a><br />
<a href="https://support.google.com/analytics/answer/2637192?hl=en&amp;visit_id=1-636288218914624195-2113255108&amp;rd=1" target="_blank" rel="noopener">https://support.google.com/analytics/answer/2637192?hl=en&amp;visit_id=1-636288218914624195-2113255108&amp;rd=1</a></p>
<p><strong>Downloading Unsampled report using Google Analytics 360 API &#8211; ZappySys REST API Task</strong></p>
<p>If you are a Google Analytics 360 user and wish to use the API to generate a file and download it in SSIS, refer to the following article. It shows how to call the Google API. It&#8217;s not about the Analytics API, but you will get a high-level idea.</p>
<p><a href="https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/">https://zappysys.com/blog/get-data-google-spreadsheet-using-ssis/</a></p>
<p>The post <a href="https://zappysys.com/blog/3-ways-get-unsampled-data-ssis-google-analytics-source/">3 ways to get Google Analytics unsampled data in SSIS</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to call Google DFP API with SSIS &#8211; DoubleClick</title>
		<link>https://zappysys.com/blog/calling-google-dfp-api-with-ssis-doubleclick-soap-api/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Tue, 14 Feb 2017 19:28:31 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[REST API Integration]]></category>
		<category><![CDATA[AdSense]]></category>
		<category><![CDATA[AdWords]]></category>
		<category><![CDATA[API Integration]]></category>
		<category><![CDATA[DFP]]></category>
		<category><![CDATA[doubleclick]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[ssis rest api task]]></category>
		<category><![CDATA[ssis xml source]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=1000</guid>

					<description><![CDATA[<p>Introduction Google DoubleClick is one of the most popular platforms for Advertisers. Many times you have need for custom integration or Automation for many operations. In this article we will learn how to Call Google DFP API (i.e. DoubleClick for Publishers) without coding using SSIS (Microsoft SQL Server Integration Services). In our previous article we [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/calling-google-dfp-api-with-ssis-doubleclick-soap-api/">How to call Google DFP API with SSIS &#8211; DoubleClick</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/02/google-doubleclick-dfp-api-integration.png"><img loading="lazy" decoding="async" class=" wp-image-1634 alignleft" src="//zappysys.com/blog/wp-content/uploads/2017/02/google-doubleclick-dfp-api-integration.png" alt="" width="198" height="198" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/google-doubleclick-dfp-api-integration.png 500w, https://zappysys.com/blog/wp-content/uploads/2017/02/google-doubleclick-dfp-api-integration-150x150.png 150w, https://zappysys.com/blog/wp-content/uploads/2017/02/google-doubleclick-dfp-api-integration-300x300.png 300w" sizes="(max-width: 198px) 100vw, 198px" /></a>Google DoubleClick is one of the most popular platforms for Advertisers. Many times you have need for custom integration or Automation for many operations. In this article we will learn how to Call Google DFP API (i.e. DoubleClick for Publishers) without coding using SSIS (Microsoft SQL Server Integration Services). In our previous article we discussed how to Integrate <a href="https://zappysys.com/blog/get-data-from-google-adwords-using-ssis/" target="_blank" rel="noopener">Google AdWords API using SSIS (Click here)</a>.</p>
<p>If you are new to SSIS then no worry there are plenty of <a href="http://www.bing.com/search?q=ssis+tutorials&amp;src=IE-TopResult&amp;FORM=IE11TR&amp;conversationid=" target="_blank" rel="noopener">tutorials for ssis</a></p>
<p>To achieve Custom integration for DoubleClick (DFP) API we will use <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source</a>. XML Source is part of <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> which has 45+ connectors and Tasks.</p>
<p>&nbsp;</p>
<h2>Prerequisite</h2>
<p>Before you can finish tasks explained in this article you have to finish below steps. This article assumes you have basic knowledge of SSIS (SQL Server Integration Services)</p>
<ol>
<li>Make sure you SSIS designer installed. Sometimes its referred as BIDS or SSDT (<a href="https://msdn.microsoft.com/en-us/mt186501" target="_blank" rel="noopener">Get from here)</a></li>
<li><a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Download SSIS PowerPack</a></li>
<li><a href="https://www.soapui.org/downloads/soapui.html" target="_blank" rel="noopener">Download SoapUI</a> (Its free third party tool to test SOAP API). SoapUI can help you to generate XML Request BODY easily from WSDL file provided by API Vendor. You can also test your service by supplying parameters.</li>
<li>Optional &#8211; Another very useful Free tool is Fiddler. You can use it to see raw request/response (<a href="https://zappysys.com/blog/how-to-use-fiddler-to-analyze-http-web-requests/" target="_blank" rel="noopener">Check this article</a>)</li>
</ol>
<h2>Download DFP API Example SSIS Package</h2>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/02/Google-DoubleClick-API-SSIS-DEMO.zip" target="_blank" rel="noopener">Click here to DFP API download Sample for SSIS</a> SSIS Package (SSIS 2012, 2014, 2016)</p>
<p>Screenshot of Sample Package:</p>
<div id="attachment_1059" style="width: 977px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-example-call-google-dfp-api-get-data-from-doubleclick.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1059" class="size-full wp-image-1059" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-example-call-google-dfp-api-get-data-from-doubleclick.png" alt="Example SSIS Package - Google DFP API Integration (Read / Write data in Google Double Click for Publisher) - No Coding required" width="967" height="650" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-example-call-google-dfp-api-get-data-from-doubleclick.png 967w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-example-call-google-dfp-api-get-data-from-doubleclick-300x202.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-example-call-google-dfp-api-get-data-from-doubleclick-272x182.png 272w" sizes="(max-width: 967px) 100vw, 967px" /></a><p id="caption-attachment-1059" class="wp-caption-text">Example SSIS Package &#8211; Google DFP API Integration (Read / Write data in Google Double Click for Publisher) &#8211; No Coding required</p></div>
<h2>Making your first DFP API Call using SSIS</h2>
<p>Once you install <a href="https://zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">PowerPack</a> you are ready to execute your very first Google DFP API Call.</p>
<p><strong>NOTE</strong>: If you don&#8217;t have any DFP network for test then see next section (Explains how to create test network for testing).</p>
<p>Lets look at how to call Google DFP API step-by-step.</p>
<ol>
<li>Create new SSIS Project and open package designer</li>
<li>Drag <a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">ZS REST API Task</a> from SSIS control flow toolbox and drop it on designer.<br />
<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;"><a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Task</a> is useful when you want to call SOAP/REST API but not necessarily parse response into rows and columns. We will look at <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source</a> later in this article which can actually parse response into rows and columns (Useful to load Google DFP data into SQL Server or other RDBMS / flatfile )</div></div></li>
<li>Double click REST API Task to configure. Select Access mode to [Url from Connection]</li>
<li>Enter following URL in the URL Textbox<br />
<pre class="crayon-plain-tag">&nbsp;https://ads.google.com/apis/ads/publisher/v201702/NetworkService</pre>
</li>
<li>From the connection dialogbox select <strong>ZS-OAUTH</strong> to create new OAuth Connection for DFP API</li>
<li>On OAuth Connection dialogbox select <strong>Google</strong> from Provider dropdown. In this demo we will use Default OAuth App but you can <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/" target="_blank" rel="noopener">register your own google OAuth app</a> if you wish to use Custom OAuth option from UI.</li>
<li>Enter following Scopes in the Scopes textbox (or select manually by clicking Select Scopes button). Scope is nothing but permission for API (In our case View/Manage DFP data and Read/Write Report Files to Cloud Storage).<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/dfp
https://www.googleapis.com/auth/devstorage.read_only
https://www.googleapis.com/auth/devstorage.write_only
https://www.googleapis.com/auth/cloud-platform.read-only
https://www.googleapis.com/auth/devstorage.full_control
https://www.googleapis.com/auth/cloud-platform
https://www.googleapis.com/auth/devstorage.read_write</pre>
</li>
<li>If you are not going call <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService" target="_blank" rel="noopener">ReportService</a> API to generate Reports in CSV format then you will need only one scope<br />
<pre class="crayon-plain-tag">https://www.googleapis.com/auth/dfp</pre>
</li>
<li>Click Generate Token button. You will see browser popup for login and then Accept option to confirm permissions like below. Once you don&#8217;t it will populate tokens and prompt to save tokens to backup file. Secure token backup to safe place.
<div id="attachment_1034" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-2-connection-call-google-dfp-api-doubleclick-soap-webservice.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1034" class="wp-image-1034" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-2-connection-call-google-dfp-api-doubleclick-soap-webservice.png" alt="SSIS OAuth Connection - Connect to Google DFP API (DoubleClick SOAP Web Service)" width="600" height="491" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-2-connection-call-google-dfp-api-doubleclick-soap-webservice.png 816w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-oauth-2-connection-call-google-dfp-api-doubleclick-soap-webservice-300x246.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-1034" class="wp-caption-text">SSIS OAuth Connection &#8211; Connect to Google DFP API (DoubleClick SOAP Web Service)</p></div></li>
<li>Once done Click Test Connection and if its green then Click OK to save connection</li>
<li>Once you are back to REST API Task UI then select Method to <strong>POST</strong></li>
<li>Select Request Body <strong>Content Type</strong> to XML (i.e. text/xml)</li>
<li>Click edit button next to <strong>Request Body</strong> and enter following XML.<br />
<pre class="crayon-plain-tag">&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
   &lt;soapenv:Header&gt;
      &lt;v20:RequestHeader/&gt;
   &lt;/soapenv:Header&gt;
   &lt;soapenv:Body&gt;
      &lt;v20:getAllNetworks/&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre>
<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 then read next section about using 3rd party tool called SoapUI. Also we have detail article for calling SOAP request. <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>. DFP has many API endpoints for different actions (e.g. <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService" target="_blank" rel="noopener">NetworkService</a> , <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/InventoryService" target="_blank" rel="noopener">InventoryService</a> , &#8230;). 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 using DFP NetworkService API for version v201702 then your <strong>help page URL would be like this</strong><br />
<a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService" target="_blank" rel="noopener">https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService</a><br />
And on the same page you will see <strong>WSDL link below</strong><br />
<a href="https://adwords.google.com/api/adwords/mcm/v201609/ManagedCustomerService?wsdl" target="_blank" rel="noopener">https://adwords.google.com/api/adwords/mcm/v201609/ManagedCustomerService?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>
</div></div></li>
<li>Once you done with above steps, your Task Configuration will look like below.
<div id="attachment_1035" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-task-call-dfp-google-doubleclick-api-getAllNetworks.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1035" class="wp-image-1035" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-task-call-dfp-google-doubleclick-api-getAllNetworks.png" alt="SSIS Rest API Task - Call Google DoubleClick API - Get all DFP Networks" width="600" height="522" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-task-call-dfp-google-doubleclick-api-getAllNetworks.png 805w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-task-call-dfp-google-doubleclick-api-getAllNetworks-300x261.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-1035" class="wp-caption-text">SSIS Rest API Task &#8211; Call Google DoubleClick API &#8211; Get all DFP Networks</p></div></li>
<li>Now click Test Request button. You will see Response popup with below content if its successful (Scroll at the bottom on response form and you will see XML data) .. see below<br />
<pre class="crayon-plain-tag">------------------------------------
Request
------------------------------------
POST https 1.1 ==&gt; /apis/ads/publisher/v201702/NetworkService
Host: ads.google.com

&gt;&gt;&gt;&gt; HEADERS &lt;&lt;&lt;&lt;&lt;
Authorization: Bearer ya29.Glz-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: text/xml;charset=UTF-8
User-Agent: ZappySysApp
Host: ads.google.com
Content-Length: 291
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

------------------------------------
Response
------------------------------------
POST 1.1 200 OK==&gt; OK

&gt;&gt;&gt;&gt; HEADERS &lt;&lt;&lt;&lt;&lt;
Content-Encoding: 
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Alt-Svc: quic=":443"; ma=2592000; v="35,34"
Transfer-Encoding: chunked
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=UTF-8
Date: Sun, 26 Feb 2017 01:18:32 GMT
Expires: Sun, 26 Feb 2017 01:18:32 GMT
Server: GSE

&gt;&gt;&gt;&gt; Cookies &lt;&lt;&lt;&lt;&lt;

&gt;&gt;&gt;&gt; CONTENT &lt;&lt;&lt;&lt;&lt;

&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;requestId&gt;27ab3d2e4e1fcb8f444b317d0b0f871d&lt;/requestId&gt;
			&lt;responseTime&gt;50&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;getAllNetworksResponse xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;rval&gt;
				&lt;id&gt;551196&lt;/id&gt;
				&lt;displayName&gt;XFP sandbox property&lt;/displayName&gt;
				&lt;networkCode&gt;238897396&lt;/networkCode&gt;
				&lt;propertyCode&gt;ca-pub-2799179143725683&lt;/propertyCode&gt;
				&lt;timeZone&gt;America/New_York&lt;/timeZone&gt;
				&lt;currencyCode&gt;USD&lt;/currencyCode&gt;
				&lt;effectiveRootAdUnitId&gt;237897516&lt;/effectiveRootAdUnitId&gt;
				&lt;isTest&gt;true&lt;/isTest&gt;
			&lt;/rval&gt;
		&lt;/getAllNetworksResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre>
&nbsp;</li>
</ol>
<h2>How to generate SOAP Request Body using SoapUI tool</h2>
<p>This section describes how to create DoubleClick SOAP API Request Body (XML fragment) for any DFP SOAP API call described anywhere in this article.</p>
<ol>
<li><a href="https://www.soapui.org/downloads/soapui.html" target="_blank" rel="noopener">Download SoapUI</a> (Its free third party tool to test SOAP API). SoapUI can help you to generate XML Request BODY easily from WSDL file provided by API Vendor. You can also test your service by supplying parameters.</li>
<li>Now download WDSL xml for appropriate API calls you want to make. Assume that you want to call  <strong>getAllNetworksResponse</strong> API found under <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService" target="_blank" rel="noopener">NetworkService</a>. For that first navigate to help file page and open help page. Make sure you select correct version from help navigation. Copy WSDL link and open in new browser window. Save XML to local disk (e.g. c:\api\dfp_networkservice_wsdl.xml (See below screenshot how to find DFP API WSDL link)
<div id="attachment_1043" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/get-dftp-soap-api-wsdl-doubleclick-web-service.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1043" class="wp-image-1043" src="//zappysys.com/blog/wp-content/uploads/2017/02/get-dftp-soap-api-wsdl-doubleclick-web-service.png" alt="How to get Google DFP API WSDL URL (Used to generate POST Body)" width="600" height="501" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/get-dftp-soap-api-wsdl-doubleclick-web-service.png 969w, https://zappysys.com/blog/wp-content/uploads/2017/02/get-dftp-soap-api-wsdl-doubleclick-web-service-300x250.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-1043" class="wp-caption-text">How to get Google DFP API WSDL URL (Used to generate POST Body)</p></div></li>
<li>Once SoapUI is downloaded and installed click <strong>File</strong> menu &gt; <strong>Create New SOAP Project</strong> option</li>
<li>Name your project (e.g. DFP API) and specify WSDL URL or File Path if it was saved locally (e.g. c:\api\dfp_networkservice_wsdl.xml) and click OK</li>
<li>Now navigate to API Action for which you would like to get Body. Click Request node (If missing create new) and edit request. You may see XML like below (If some optional parameters not visible in XML then click Re-create request with optional parameters button from toolbar)
<div id="attachment_1044" style="width: 610px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-generate-soap-request-body-from-wsdl.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1044" class="wp-image-1044" src="//zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-generate-soap-request-body-from-wsdl.png" alt="Call Google DFP API - Generate SOAP Request Body XML using SoapUI (Google DoubleClick Web Service)" width="600" height="284" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-generate-soap-request-body-from-wsdl.png 727w, https://zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-generate-soap-request-body-from-wsdl-300x142.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></a><p id="caption-attachment-1044" class="wp-caption-text">Call Google DFP API &#8211; Generate SOAP Request Body XML using SoapUI (Google DoubleClick Web Service)</p></div></li>
<li>Edit necessary parameters from above XML code and copy to Body of SSIS REST API Task.</li>
</ol>
<h2>Creating test network &#8211; DFP Sandbox</h2>
<p>Very first step we recommend before testing DFP API call is <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService#makeTestNetwork">create test network</a>. You can call DFP API against LIVE network but not recommended if you are calling create/update API.</p>
<p>To create test network you can follow exact same steps described in the previous section except the Body step (Step#12). Use following Request body to call makeTestNetwork command.</p>
<h3>API makeTestNetwork &#8211; Request</h3>
<p>URL: https://ads.google.com/apis/ads/publisher/v201702/NetworkService<br />
Body (see below):</p><pre class="crayon-plain-tag">&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
   &lt;soapenv:Header&gt;
      &lt;v20:RequestHeader/&gt;
   &lt;/soapenv:Header&gt;
   &lt;soapenv:Body&gt;
      &lt;v20:makeTestNetwork/&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre><p>
Once you click Test you may receive following response. Note your network code (e.g. 1122334455 from below). This network code is used in pretty much all DFP API to view or manage ad network related items or properties.</p>
<h3>API makeTestNetwork &#8211; Response</h3>
<pre class="crayon-plain-tag">&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;requestId&gt;ba61d79efee325bf4b5aa45c46836021&lt;/requestId&gt;
			&lt;responseTime&gt;1021&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;makeTestNetworkResponse xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;rval&gt;
				&lt;id&gt;551196&lt;/id&gt;
				&lt;displayName&gt;XFP sandbox property&lt;/displayName&gt;
				&lt;networkCode&gt;1122334455&lt;/networkCode&gt;
				&lt;propertyCode&gt;ca-pub-2799179143725683&lt;/propertyCode&gt;
				&lt;timeZone&gt;America/Los_Angeles&lt;/timeZone&gt;
				&lt;currencyCode&gt;USD&lt;/currencyCode&gt;
				&lt;effectiveRootAdUnitId&gt;237897516&lt;/effectiveRootAdUnitId&gt;
				&lt;isTest&gt;true&lt;/isTest&gt;
			&lt;/rval&gt;
		&lt;/makeTestNetworkResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre>
Above response contains test networkcode copy that code becuase you will need in almost every API call you make later. You can only have one test network. If test network is already created and you try to execute above code then you may receive error  <strong>AuthenticationError.GOOGLE_ACCOUNT_ALREADY_ASSOCIATED_WITH_NETWORK</strong></p>
<p>You can also get network code using two different ways.</p>
<ul>
<li>Visit your DFP console homepage by visiting <a href="https://www.google.com/dfp/" target="_blank" rel="noopener">https://www.google.com/dfp/</a> and you will see network name and code in the top potion. Also its listed in the URL (e.g. https://www.google.com/dfp/1234567)</li>
<li>Another way to get available networks for your login is to visit DFP API Play ground here <a href="https://dfp-playground.appspot.com/" target="_blank" rel="noopener">https://dfp-playground.appspot.com/</a> and you will see network list in the dropdown ( name and network code)</li>
</ul>
<h2>How to Create new Ad Units</h2>
<p>Now lets look at an example which will create few Ad Units by calling <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/InventoryService#createAdUnits" target="_blank" rel="noopener">createAdUnits</a> API. If you are creating Ad Unit at the root level then you will need to specify correct Parent ID (i.e  effectiveRootAdUnitId). To obtain that Parent ID you may have to call  <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService#getcurrentnetwork" target="_blank" rel="noopener">getCurrentNetwork</a> API. In the response you will see effectiveRootAdUnitId.</p>
<p>There is another way to know effectiveRootAdUnitId or Id of any Ad Units which can be Parent for new AdUnit. Goto google.com/dfp &gt; Click Inventory Tab &gt; Click Ad Units Side menu &gt; Click Download ad units hyper link. You can also download AdUnits as CSV file from DFP Portal and look for Ad Units which are created at the root. Parent ID column for Root level Ad Units is basically called effectiveRootAdUnitId.</p>
<p>Now lets look at how to get EffectiveRootID by calling <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/NetworkService#getcurrentnetwork" target="_blank" rel="noopener">getCurrentNetwork</a>.</p>
<h3>API getCurrentNetwork &#8211; Request</h3>
<p>URL: https://ads.google.com/apis/ads/publisher/v201702/NetworkService<br />
Body (see below):</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://www.google.com/apis/ads/publisher/v201608"&gt;
		&lt;networkCode xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;1122334455&lt;/networkCode&gt;
		&lt;applicationName xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;ZappySysApp&lt;/applicationName&gt;
	&lt;/RequestHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;getCurrentNetwork xmlns="https://www.google.com/apis/ads/publisher/v201608" /&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
&nbsp;</p>
<h3>API getCurrentNetwork &#8211; Response</h3>
<pre class="crayon-plain-tag">&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;requestId&gt;81d1b00e8fbfb862129eb2dd485cf7bb&lt;/requestId&gt;
			&lt;responseTime&gt;4507&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;getCurrentNetworkResponse xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;rval&gt;
				&lt;id&gt;551196&lt;/id&gt;
				&lt;displayName&gt;XFP sandbox property&lt;/displayName&gt;
				&lt;networkCode&gt;1122334455&lt;/networkCode&gt;
				&lt;propertyCode&gt;ca-pub-2799179143725683&lt;/propertyCode&gt;
				&lt;timeZone&gt;America/New_York&lt;/timeZone&gt;
				&lt;currencyCode&gt;USD&lt;/currencyCode&gt;
				&lt;effectiveRootAdUnitId&gt;237897516&lt;/effectiveRootAdUnitId&gt;
				&lt;isTest&gt;true&lt;/isTest&gt;
			&lt;/rval&gt;
		&lt;/getCurrentNetworkResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre>
&nbsp;</p>
<p>If you want to save single Element Value from Response into SSIS Variable then perform following steps (example of how to get just effectiveRootAdUnitId from above response)</p>
<ol>
<li>On REST API Task &gt; Go to Response Tab &gt; Select Response Content Type = XML</li>
<li>Enter following expression in the XPath filter<br />
<pre class="crayon-plain-tag">//*[local-name() = 'effectiveRootAdUnitId']</pre>
</li>
<li>Check Save response content option</li>
<li>Select Variable from Dropdown &#8211; Click New Variable &gt; Name it RootAdUnitId.</li>
<li>Click Test Request Button to test&#8230;. In the content textbox you will now see only Numeric value extracted by Filter</li>
</ol>
<div id="attachment_1050" style="width: 832px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-save-response-into-variable-xpath-jsonpath-filter-extract-value.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1050" class="size-full wp-image-1050" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-save-response-into-variable-xpath-jsonpath-filter-extract-value.png" alt="SSIS REST Api Task - How to extract single vale from response and save to SSIS variable" width="822" height="616" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-save-response-into-variable-xpath-jsonpath-filter-extract-value.png 822w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-save-response-into-variable-xpath-jsonpath-filter-extract-value-300x225.png 300w" sizes="(max-width: 822px) 100vw, 822px" /></a><p id="caption-attachment-1050" class="wp-caption-text">SSIS REST Api Task &#8211; How to extract single vale from response and save to SSIS variable</p></div>
<p>Once you know Parent ID for your AdUnit now lets look at how to create Ad Units by calling <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/InventoryService#createAdUnits" target="_blank" rel="noopener">createAdUnits</a></p>
<h3>API createAdUnits &#8211; Request</h3>
<p>URL: https://ads.google.com/apis/ads/publisher/v201702/InventoryService<br />
Body (see below):</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://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;networkCode xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;1122334455&lt;/networkCode&gt;
			&lt;applicationName xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;ZappySysApp&lt;/applicationName&gt;
		&lt;/RequestHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;createAdUnits xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;adUnits&gt;
				&lt;parentId&gt;237897516&lt;/parentId&gt;
				&lt;name&gt;Ad_Unit_0&lt;/name&gt;
				&lt;description&gt;Ad unit description #0.&lt;/description&gt;
				&lt;targetWindow&gt;BLANK&lt;/targetWindow&gt;
				&lt;adUnitSizes&gt;
					&lt;size&gt;
						&lt;width&gt;300&lt;/width&gt;
						&lt;height&gt;250&lt;/height&gt;
					&lt;/size&gt;
					&lt;environmentType&gt;BROWSER&lt;/environmentType&gt;
				&lt;/adUnitSizes&gt;
			&lt;/adUnits&gt;
			&lt;adUnits&gt;
				&lt;parentId&gt;237897516&lt;/parentId&gt;
				&lt;name&gt;Ad_Unit_1&lt;/name&gt;
				&lt;description&gt;Ad unit description #1.&lt;/description&gt;
				&lt;targetWindow&gt;BLANK&lt;/targetWindow&gt;
				&lt;adUnitSizes&gt;
					&lt;size&gt;
						&lt;width&gt;300&lt;/width&gt;
						&lt;height&gt;250&lt;/height&gt;
					&lt;/size&gt;
					&lt;environmentType&gt;BROWSER&lt;/environmentType&gt;
				&lt;/adUnitSizes&gt;
			&lt;/adUnits&gt;			
		&lt;/createAdUnits&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
<h3>API createAdUnits &#8211; Response</h3>
</p><pre class="crayon-plain-tag">&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;requestId&gt;b244d7ba9b65e96fc42b849a7bfb16e4&lt;/requestId&gt;
			&lt;responseTime&gt;331&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;createAdUnitsResponse xmlns="https://www.google.com/apis/ads/publisher/v201608"&gt;
			&lt;rval&gt;
				&lt;id&gt;252312396&lt;/id&gt;
				&lt;parentId&gt;237897516&lt;/parentId&gt;
				&lt;hasChildren&gt;false&lt;/hasChildren&gt;
				&lt;parentPath&gt;
					&lt;id&gt;237897516&lt;/id&gt;
					&lt;name&gt;ca-pub-2799179143725683&lt;/name&gt;
					&lt;adUnitCode&gt;ca-pub-2799179143725683&lt;/adUnitCode&gt;
				&lt;/parentPath&gt;
				&lt;name&gt;Ad_Unit_0&lt;/name&gt;
				&lt;description&gt;Ad unit description#0.&lt;/description&gt;
				&lt;targetWindow&gt;BLANK&lt;/targetWindow&gt;
				&lt;status&gt;ACTIVE&lt;/status&gt;
				&lt;adUnitCode&gt;253312396&lt;/adUnitCode&gt;
				&lt;adUnitSizes&gt;
					&lt;size&gt;
						&lt;width&gt;300&lt;/width&gt;
						&lt;height&gt;250&lt;/height&gt;
						&lt;isAspectRatio&gt;false&lt;/isAspectRatio&gt;
					&lt;/size&gt;
					&lt;environmentType&gt;BROWSER&lt;/environmentType&gt;
					&lt;fullDisplayString&gt;300x250&lt;/fullDisplayString&gt;
				&lt;/adUnitSizes&gt;
				&lt;mobilePlatform&gt;SITE&lt;/mobilePlatform&gt;
				&lt;explicitlyTargeted&gt;false&lt;/explicitlyTargeted&gt;
				&lt;inheritedAdSenseSettings&gt;
					&lt;value&gt;
						&lt;adSenseEnabled&gt;true&lt;/adSenseEnabled&gt;
						&lt;borderColor&gt;FFFFFF&lt;/borderColor&gt;
						&lt;titleColor&gt;0000FF&lt;/titleColor&gt;
						&lt;backgroundColor&gt;FFFFFF&lt;/backgroundColor&gt;
						&lt;textColor&gt;000000&lt;/textColor&gt;
						&lt;urlColor&gt;008000&lt;/urlColor&gt;
						&lt;adType&gt;TEXT_AND_IMAGE&lt;/adType&gt;
						&lt;borderStyle&gt;DEFAULT&lt;/borderStyle&gt;
						&lt;fontFamily&gt;DEFAULT&lt;/fontFamily&gt;
						&lt;fontSize&gt;DEFAULT&lt;/fontSize&gt;
					&lt;/value&gt;
				&lt;/inheritedAdSenseSettings&gt;
				&lt;lastModifiedDateTime&gt;
					&lt;date&gt;
						&lt;year&gt;2017&lt;/year&gt;
						&lt;month&gt;2&lt;/month&gt;
						&lt;day&gt;27&lt;/day&gt;
					&lt;/date&gt;
					&lt;hour&gt;7&lt;/hour&gt;
					&lt;minute&gt;23&lt;/minute&gt;
					&lt;second&gt;32&lt;/second&gt;
					&lt;timeZoneID&gt;PST8PDT&lt;/timeZoneID&gt;
				&lt;/lastModifiedDateTime&gt;
				&lt;smartSizeMode&gt;NONE&lt;/smartSizeMode&gt;
				&lt;isSharedByDistributor&gt;false&lt;/isSharedByDistributor&gt;
				&lt;isSetTopBoxEnabled&gt;false&lt;/isSetTopBoxEnabled&gt;
			&lt;/rval&gt;
			&lt;rval&gt;
				&lt;id&gt;252312516&lt;/id&gt;
				&lt;parentId&gt;237897516&lt;/parentId&gt;
				&lt;hasChildren&gt;false&lt;/hasChildren&gt;
				&lt;parentPath&gt;
					&lt;id&gt;237897516&lt;/id&gt;
					&lt;name&gt;ca-pub-2799179143725683&lt;/name&gt;
					&lt;adUnitCode&gt;ca-pub-2799179143725683&lt;/adUnitCode&gt;
				&lt;/parentPath&gt;
				&lt;name&gt;Ad_Unit_1&lt;/name&gt;
				&lt;description&gt;Ad unit description#2.&lt;/description&gt;
				&lt;targetWindow&gt;BLANK&lt;/targetWindow&gt;
				&lt;status&gt;ACTIVE&lt;/status&gt;
				&lt;adUnitCode&gt;253312516&lt;/adUnitCode&gt;
				&lt;adUnitSizes&gt;
					&lt;size&gt;
						&lt;width&gt;300&lt;/width&gt;
						&lt;height&gt;250&lt;/height&gt;
						&lt;isAspectRatio&gt;false&lt;/isAspectRatio&gt;
					&lt;/size&gt;
					&lt;environmentType&gt;BROWSER&lt;/environmentType&gt;
					&lt;fullDisplayString&gt;300x250&lt;/fullDisplayString&gt;
				&lt;/adUnitSizes&gt;
				&lt;mobilePlatform&gt;SITE&lt;/mobilePlatform&gt;
				&lt;explicitlyTargeted&gt;false&lt;/explicitlyTargeted&gt;
				&lt;inheritedAdSenseSettings&gt;
					&lt;value&gt;
						&lt;adSenseEnabled&gt;true&lt;/adSenseEnabled&gt;
						&lt;borderColor&gt;FFFFFF&lt;/borderColor&gt;
						&lt;titleColor&gt;0000FF&lt;/titleColor&gt;
						&lt;backgroundColor&gt;FFFFFF&lt;/backgroundColor&gt;
						&lt;textColor&gt;000000&lt;/textColor&gt;
						&lt;urlColor&gt;008000&lt;/urlColor&gt;
						&lt;adType&gt;TEXT_AND_IMAGE&lt;/adType&gt;
						&lt;borderStyle&gt;DEFAULT&lt;/borderStyle&gt;
						&lt;fontFamily&gt;DEFAULT&lt;/fontFamily&gt;
						&lt;fontSize&gt;DEFAULT&lt;/fontSize&gt;
					&lt;/value&gt;
				&lt;/inheritedAdSenseSettings&gt;
				&lt;lastModifiedDateTime&gt;
					&lt;date&gt;
						&lt;year&gt;2017&lt;/year&gt;
						&lt;month&gt;2&lt;/month&gt;
						&lt;day&gt;27&lt;/day&gt;
					&lt;/date&gt;
					&lt;hour&gt;7&lt;/hour&gt;
					&lt;minute&gt;23&lt;/minute&gt;
					&lt;second&gt;32&lt;/second&gt;
					&lt;timeZoneID&gt;PST8PDT&lt;/timeZoneID&gt;
				&lt;/lastModifiedDateTime&gt;
				&lt;smartSizeMode&gt;NONE&lt;/smartSizeMode&gt;
				&lt;isSharedByDistributor&gt;false&lt;/isSharedByDistributor&gt;
				&lt;isSetTopBoxEnabled&gt;false&lt;/isSetTopBoxEnabled&gt;
			&lt;/rval&gt;
				&lt;id&gt;252312876&lt;/id&gt;
				&lt;parentId&gt;237897516&lt;/parentId&gt;
				&lt;hasChildren&gt;false&lt;/hasChildren&gt;
				&lt;parentPath&gt;
					&lt;id&gt;237897516&lt;/id&gt;
					&lt;name&gt;ca-pub-2799179143725683&lt;/name&gt;
					&lt;adUnitCode&gt;ca-pub-2799179143725683&lt;/adUnitCode&gt;
				&lt;/parentPath&gt;
				&lt;name&gt;Ad_Unit_4&lt;/name&gt;
				&lt;description&gt;Ad unit description.&lt;/description&gt;
				&lt;targetWindow&gt;BLANK&lt;/targetWindow&gt;
				&lt;status&gt;ACTIVE&lt;/status&gt;
				&lt;adUnitCode&gt;253312876&lt;/adUnitCode&gt;
				&lt;adUnitSizes&gt;
					&lt;size&gt;
						&lt;width&gt;300&lt;/width&gt;
						&lt;height&gt;250&lt;/height&gt;
						&lt;isAspectRatio&gt;false&lt;/isAspectRatio&gt;
					&lt;/size&gt;
					&lt;environmentType&gt;BROWSER&lt;/environmentType&gt;
					&lt;fullDisplayString&gt;300x250&lt;/fullDisplayString&gt;
				&lt;/adUnitSizes&gt;
				&lt;mobilePlatform&gt;SITE&lt;/mobilePlatform&gt;
				&lt;explicitlyTargeted&gt;false&lt;/explicitlyTargeted&gt;
				&lt;inheritedAdSenseSettings&gt;
					&lt;value&gt;
						&lt;adSenseEnabled&gt;true&lt;/adSenseEnabled&gt;
						&lt;borderColor&gt;FFFFFF&lt;/borderColor&gt;
						&lt;titleColor&gt;0000FF&lt;/titleColor&gt;
						&lt;backgroundColor&gt;FFFFFF&lt;/backgroundColor&gt;
						&lt;textColor&gt;000000&lt;/textColor&gt;
						&lt;urlColor&gt;008000&lt;/urlColor&gt;
						&lt;adType&gt;TEXT_AND_IMAGE&lt;/adType&gt;
						&lt;borderStyle&gt;DEFAULT&lt;/borderStyle&gt;
						&lt;fontFamily&gt;DEFAULT&lt;/fontFamily&gt;
						&lt;fontSize&gt;DEFAULT&lt;/fontSize&gt;
					&lt;/value&gt;
				&lt;/inheritedAdSenseSettings&gt;
				&lt;lastModifiedDateTime&gt;
					&lt;date&gt;
						&lt;year&gt;2017&lt;/year&gt;
						&lt;month&gt;2&lt;/month&gt;
						&lt;day&gt;27&lt;/day&gt;
					&lt;/date&gt;
					&lt;hour&gt;7&lt;/hour&gt;
					&lt;minute&gt;23&lt;/minute&gt;
					&lt;second&gt;32&lt;/second&gt;
					&lt;timeZoneID&gt;PST8PDT&lt;/timeZoneID&gt;
				&lt;/lastModifiedDateTime&gt;
				&lt;smartSizeMode&gt;NONE&lt;/smartSizeMode&gt;
				&lt;isSharedByDistributor&gt;false&lt;/isSharedByDistributor&gt;
				&lt;isSetTopBoxEnabled&gt;false&lt;/isSetTopBoxEnabled&gt;
			&lt;/rval&gt;
		&lt;/createAdUnitsResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
<h2>Loading Google DoubleClick data into SQL Server Table</h2>
<p>So far we saw how to make simple DFP API calls without doing any parsing. Now lets look at how to use <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source</a> which not only make API calls but it will parse XML Response into rows and columns which can be loaded into target database such as SQL Server, Oracle, MySQL or even Flat File. XML Source also supports pagination so if you have many records it will automatically loop through all response untill all records are fetched.</p>
<h3>Step-By-Step &#8211; Using XML Source to read Google DFP data (Parse into rows and columns)</h3>
<ol>
<li>Assuming you have tested your first DFP API Call (Explianed in the beginning of this article). You must have OAuth connection tested for API call.</li>
<li>Drag new Data flow task from SSIS Toolbox</li>
<li>Inside Data flow designer drag and drop <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">ZS XML Source</a> from toolbox</li>
<li>Double click XML Source to configure.</li>
<li>Set URL as below<br />
https://ads.google.com/apis/ads/publisher/v201702/InventoryService</li>
<li>Check Use credentials option and from Drop down select OAuth connection manager (created in previous section)</li>
<li>Select Method = POST,</li>
<li>Select Request Content Type = XML (text/xml)</li>
<li>Enter Body as below (Click edit button).<br />
<pre class="crayon-plain-tag">&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
   &lt;soapenv:Header&gt;
      &lt;v20:RequestHeader&gt;
         &lt;v20:networkCode&gt;238897396&lt;/v20:networkCode&gt;
         &lt;v20:applicationName&gt;ZappySysApp&lt;/v20:applicationName&gt;
      &lt;/v20:RequestHeader&gt;
   &lt;/soapenv:Header&gt;
   &lt;soapenv:Body&gt;
      &lt;v20:getAdUnitsByStatement&gt;
         &lt;v20:filterStatement&gt;
            &lt;v20:query&gt;WHERE Status='ACTIVE'&lt;/v20:query&gt;
         &lt;/v20:filterStatement&gt;
      &lt;/v20:getAdUnitsByStatement&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre>
Notice that in above we calling <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/InventoryService#getAdUnitsByStatement" target="_blank" rel="noopener">getAdUnitsByStatement </a>API to fetch all Ad Units which are Active. Here is<a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/InventoryService.Statement" target="_blank" rel="noopener"> more information about Query Syntax</a> for any API call getXXXXXXByStaement</li>
<li>Now click on <strong>Select Filter</strong> button and select results node and click OK. If prompted add array to list.
<div id="attachment_1054" style="width: 965px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-api-set-filter.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1054" class="size-full wp-image-1054" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-api-set-filter.png" alt="SSIS XML Source - Get data from Google DFP API using OAuth (Configure URL, Body and Filter)" width="955" height="750" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-api-set-filter.png 955w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-api-set-filter-300x236.png 300w" sizes="(max-width: 955px) 100vw, 955px" /></a><p id="caption-attachment-1054" class="wp-caption-text">SSIS XML Source &#8211; Get data from Google DFP API using OAuth (Configure URL, Body and Filter)</p></div></li>
<li>Click Preview to see data. Click Columns tab to review data types (Auto detected). If you wish to change length or datatype then edit there and check Lock option (Last column)
<div id="attachment_1055" style="width: 669px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-preview-google-dfp-data.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1055" class="size-full wp-image-1055" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-preview-google-dfp-data.png" alt="SSIS XML Source - Preview Response for Google DoubleClick API Call - Parse into Rows/Columns" width="659" height="272" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-preview-google-dfp-data.png 659w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-preview-google-dfp-data-300x124.png 300w" sizes="(max-width: 659px) 100vw, 659px" /></a><p id="caption-attachment-1055" class="wp-caption-text">SSIS XML Source &#8211; Preview Response for Google DoubleClick API Call &#8211; Parse into Rows/Columns</p></div></li>
<li>Click OK to save UI</li>
<li>Connect XML Source to same target (e.g. OLEDB Destination &#8211; SQL Server Connection)</li>
<li>Run data flow
<div id="attachment_1056" style="width: 602px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-load-into-sql-server.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1056" class="size-full wp-image-1056" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-load-into-sql-server.png" alt="SSIS Execution - Read from Google DFP and load into SQL Server Table" width="592" height="358" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-load-into-sql-server.png 592w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-get-data-from-google-dfp-doubleclick-load-into-sql-server-300x181.png 300w" sizes="(max-width: 592px) 100vw, 592px" /></a><p id="caption-attachment-1056" class="wp-caption-text">SSIS Execution &#8211; Read from Google DFP and load into SQL Server Table</p></div></li>
</ol>
<h3>Configure Pagination for Google DFP API / PQL Query result</h3>
<p>If you have large dataset to read from DoubleClick API ( when calling API such as <strong>getxxxxxxByStatement</strong>) then we recommend to supply LIMIT and OFFSET clause in your <a href="https://developers.google.com/doubleclick-publishers/docs/pqlreference" target="_blank" rel="noopener">PQL query</a>.</p>
<p>For example if you have 2000 ad units and you want to limit response size by maximum 300 rows then your query can be like below</p><pre class="crayon-plain-tag">--For first request (returns results 1-300)
WHERE Status='ACTIVE' LIMIT 300 OFFSET 0

--For second request (returns results 301-600)
WHERE Status='ACTIVE' LIMIT 300 OFFSET 300

--For third request  (returns results 601-900)
WHERE Status='ACTIVE' LIMIT 300 OFFSET 600

........</pre><p>
This looping logic can be complex to implement if you do manually. But no worry if you are using <a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source</a>. It comes with many pagination options (<a href="//zappysys.com/blog/ssis-rest-api-looping-until-no-more-pages-found/" target="_blank" rel="noopener">Click here to read more about pagination</a>)</p>
<p>See below screenshot how to configure Pagination options for Google DoubleClick API. Basically two places you have to change. Inside body you have to set placeholder and change few settings on Pagination Tab.</p>
<div id="attachment_1052" style="width: 726px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-paginate-large-resultset-google-dfp-api-doubleclick-pql-query-paging.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1052" class="size-full wp-image-1052" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-paginate-large-resultset-google-dfp-api-doubleclick-pql-query-paging.png" alt="SSIS XML Source - Configure Pagination for Google DoubleClick API data fetch - PQL LIMIT and OFFSET clause for Google DFP API" width="716" height="608" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-paginate-large-resultset-google-dfp-api-doubleclick-pql-query-paging.png 716w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-paginate-large-resultset-google-dfp-api-doubleclick-pql-query-paging-300x255.png 300w" sizes="(max-width: 716px) 100vw, 716px" /></a><p id="caption-attachment-1052" class="wp-caption-text">SSIS XML Source &#8211; Configure Pagination for Google DoubleClick API data fetch &#8211; PQL LIMIT and OFFSET clause for Google DFP API</p></div>
<div id="attachment_1053" style="width: 715px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-configure-pagination-using-post-data-method-call-google-dfp-api-doubleclick.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1053" class="size-full wp-image-1053" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-configure-pagination-using-post-data-method-call-google-dfp-api-doubleclick.png" alt="SSIS XML Source - Configure Pagination for Google DoubleClick API data fetch - Set Pagination Mode" width="705" height="510" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-configure-pagination-using-post-data-method-call-google-dfp-api-doubleclick.png 705w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-xml-source-configure-pagination-using-post-data-method-call-google-dfp-api-doubleclick-300x217.png 300w" sizes="(max-width: 705px) 100vw, 705px" /></a><p id="caption-attachment-1053" class="wp-caption-text">SSIS XML Source &#8211; Configure Pagination for Google DoubleClick API data fetch &#8211; Set Pagination Mode</p></div>
<h2>Create CSV Report File and Download in GZip format (*.gz)</h2>
<p>Sometime you have to download large amount of data (Possibly millions of rows) in that case Bulk approach would be better. <a href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService" target="_blank" rel="noopener">DFP ReportService API</a> allows to call following APIs which can be used to produce CSV report file in *.gz format and then you can download it using REST API Task.</p>
<p>Below are high level steps you have to perform to produce report file and download it.</p>
<ul>
<li>Create the ReportJob by invoking <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.html#runReportJob">runReportJob</a> command .</li>
<li>Poll the ReportJob object using <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.html#getReportJob">ReportService.getReportJob</a> (This is required because file is not available right away) .</li>
<li>Continue to poll the ReportJob object until the <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.ReportJob.html#reportJobStatus">reportJobStatus</a> field is equal to <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.ReportJobStatus.html#COMPLETED">COMPLETED</a> or <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.ReportJobStatus.html#FAILED">FAILED</a>.</li>
<li>If successful, fetch the URL for downloading the report by invoking <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.html#getReportDownloadURL">getReportDownloadURL</a>.</li>
</ul>
<p>Here is the sample SSIS Package to Perform this Action.</p>
<p><a href="//zappysys.com/blog/wp-content/uploads/2017/02/Google-DoubleClick-API-SSIS-DEMO.zip" target="_blank" rel="noopener">Click here to DFP API download Sample for SSIS</a> SSIS Package (SSIS 2012, 2014, 2016)</p>
<p>See below screenshot how to generate Google DFP Report File and download / extract (Unzip) using Drag and Drop SSIS workflow.</p>
<div id="attachment_1179" style="width: 837px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-doubleclick-soap-create-report-download-file-csv-gzip-format.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1179" class="size-full wp-image-1179" src="//zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-doubleclick-soap-create-report-download-file-csv-gzip-format.png" alt="Create Google DFP Report File (CSV / Gzip) and Download Using SSIS (Example of ReportService functions runReportJob, getReportJob and .getReportDownloadURL)" width="827" height="739" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-doubleclick-soap-create-report-download-file-csv-gzip-format.png 827w, https://zappysys.com/blog/wp-content/uploads/2017/02/google-dfp-api-doubleclick-soap-create-report-download-file-csv-gzip-format-300x268.png 300w" sizes="(max-width: 827px) 100vw, 827px" /></a><p id="caption-attachment-1179" class="wp-caption-text">Create Google DFP Report File (CSV / Gzip) and Download Using SSIS (Example of ReportService functions runReportJob, getReportJob and .getReportDownloadURL)</p></div>
<h3>Call runReportJob (Start DFP Report JOB)</h3>
<p>Very first step to produce DFP Report file is call <a class="codelink" href="https://developers.google.com/doubleclick-publishers/docs/reference/v201702/ReportService.html#runReportJob">ReportService &gt;&gt; runReportJob</a> API. See below Command.</p>
<p><strong>Extract Single XML Node Value from SOAP API Response using XPATH</strong></p>
<p>Once you get response you can extract id of your JOB using XPAth Expression (See REST API Task response settings tab. Change Format to XML and type following XPATH expression. This will look for &lt;id&gt;111111&lt;/id&gt; node anywhere in SOAP response XML and extract value (i.e. 111111 )  .. For screenshot see next section</p><pre class="crayon-plain-tag">//*[local-name() = 'id']</pre><p>
<strong>Request</strong></p><pre class="crayon-plain-tag">POST https://ads.google.com/apis/ads/publisher/v201702/ReportService HTTP/1.1
Authorization: Bearer ya29.xxxxxxxxxxxxxxxxxxxxxAKqG89gM-TpReRXO
User-Agent: ZappySysApp/1.0.2017.10531
Content-Type: text/xml
Accept: */*
Cache-Control: no-cache
Host: ads.google.com
Content-Length: 1018
Expect: 100-continue
Accept-Encoding: gzip, deflate

&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
	&lt;soapenv:Header&gt;
		&lt;v20:RequestHeader&gt;
			&lt;v20:networkCode&gt;238897396&lt;/v20:networkCode&gt;
			&lt;v20:applicationName&gt;ZappySysApp&lt;/v20:applicationName&gt;
		&lt;/v20:RequestHeader&gt;
	&lt;/soapenv:Header&gt;
	&lt;soapenv:Body&gt;
		&lt;v20:runReportJob&gt;
			&lt;v20:reportJob&gt;
				&lt;v20:reportQuery&gt;
					&lt;v20:dimensions&gt;DATE&lt;/v20:dimensions&gt;
					&lt;v20:dimensions&gt;LINE_ITEM_ID&lt;/v20:dimensions&gt;
					&lt;v20:dimensions&gt;LINE_ITEM_NAME&lt;/v20:dimensions&gt;
					&lt;v20:dimensions&gt;AD_UNIT_NAME&lt;/v20:dimensions&gt;
					&lt;v20:columns&gt;AD_SERVER_IMPRESSIONS&lt;/v20:columns&gt;
					&lt;v20:columns&gt;AD_SERVER_CLICKS&lt;/v20:columns&gt;
					&lt;v20:dimensionAttributes&gt;LINE_ITEM_COST_TYPE&lt;/v20:dimensionAttributes&gt;
					&lt;v20:dimensionAttributes&gt;LINE_ITEM_GOAL_QUANTITY&lt;/v20:dimensionAttributes&gt;
					&lt;v20:dateRangeType&gt;LAST_MONTH&lt;/v20:dateRangeType&gt;
				&lt;/v20:reportQuery&gt;
			&lt;/v20:reportJob&gt;
		&lt;/v20:runReportJob&gt;
	&lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre><p>
<strong>Response</strong></p><pre class="crayon-plain-tag">HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Fri, 02 Jun 2017 21:23:41 GMT
Expires: Fri, 02 Jun 2017 21:23:41 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="38,37,36,35"
Content-Length: 999

&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;requestId&gt;f03e7e474fde2a5f9c5d7c9d7eb83923&lt;/requestId&gt;
			&lt;responseTime&gt;846&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;runReportJobResponse xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;rval&gt;
				&lt;id&gt;10000297829&lt;/id&gt;
				&lt;reportQuery&gt;
					&lt;dimensions&gt;DATE&lt;/dimensions&gt;
					&lt;dimensions&gt;LINE_ITEM_ID&lt;/dimensions&gt;
					&lt;dimensions&gt;LINE_ITEM_NAME&lt;/dimensions&gt;
					&lt;dimensions&gt;AD_UNIT_NAME&lt;/dimensions&gt;
					&lt;adUnitView&gt;TOP_LEVEL&lt;/adUnitView&gt;
					&lt;columns&gt;AD_SERVER_IMPRESSIONS&lt;/columns&gt;
					&lt;columns&gt;AD_SERVER_CLICKS&lt;/columns&gt;
					&lt;dimensionAttributes&gt;LINE_ITEM_COST_TYPE&lt;/dimensionAttributes&gt;
					&lt;dimensionAttributes&gt;LINE_ITEM_GOAL_QUANTITY&lt;/dimensionAttributes&gt;
					&lt;dateRangeType&gt;LAST_MONTH&lt;/dateRangeType&gt;
					&lt;useSalesLocalTimeZone&gt;false&lt;/useSalesLocalTimeZone&gt;
					&lt;includeZeroSalesRows&gt;false&lt;/includeZeroSalesRows&gt;
				&lt;/reportQuery&gt;
			&lt;/rval&gt;
		&lt;/runReportJobResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
<h3>Call getReportJob (Poll JOB Status)</h3>
<p>Second step is to make sure is Report Status check. For large report it make take several seconds or minutes before you can get Download URL (See Next Step). If you try to call Next step before Report is ready then you may get error. So better to add Polling logic.</p>
<p><strong>Extract Single XML Node Value from SOAP API Response using XPATH</strong></p>
<p>&nbsp;</p>
<p>Once you get response you can extract status of your JOB using XPAth Expression (See REST API Task response settings tab. Change Format to XML and type following XPATH expression. This will look for &lt;rval&gt;IN_PROGRESS&lt;/rval&gt; node anywhere in SOAP response XML and extract value (i.e. IN_PROGRESS )</p><pre class="crayon-plain-tag">//*[local-name() = 'rval']</pre><p>
<div id="attachment_1182" style="width: 719px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-xml-response-extract-node-value-xpath-soap-body.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-1182" class="size-full wp-image-1182" src="//zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-xml-response-extract-node-value-xpath-soap-body.png" alt="Extract Single XML Node Value from SOAP API Response - Use XPATH in SSIS" width="709" height="417" srcset="https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-xml-response-extract-node-value-xpath-soap-body.png 709w, https://zappysys.com/blog/wp-content/uploads/2017/02/ssis-rest-api-xml-response-extract-node-value-xpath-soap-body-300x176.png 300w" sizes="(max-width: 709px) 100vw, 709px" /></a><p id="caption-attachment-1182" class="wp-caption-text">Extract Single XML Node Value from SOAP API Response &#8211; Use XPATH in SSIS</p></div>
<p><strong>Request</strong></p><pre class="crayon-plain-tag">POST https://ads.google.com/apis/ads/publisher/v201702/ReportService HTTP/1.1
Authorization: Bearer ya29.xxxxxxxxxxxxxxxxxxXmWqmq
User-Agent: ZappySysApp/1.0.2017.10531
Content-Type: text/xml
Accept: */*
Cache-Control: no-cache
Host: ads.google.com
Content-Length: 524
Expect: 100-continue
Accept-Encoding: gzip, deflate

&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
   &lt;soapenv:Header&gt;
      &lt;v20:RequestHeader&gt;
         &lt;v20:networkCode&gt;238897396&lt;/v20:networkCode&gt;
         &lt;v20:applicationName&gt;ZappySysApp&lt;/v20:applicationName&gt;
      &lt;/v20:RequestHeader&gt;
   &lt;/soapenv:Header&gt;
   &lt;soapenv:Body&gt;
      &lt;v20:getReportJobStatus&gt;
       &lt;v20:reportJobId&gt;10000297829&lt;/v20:reportJobId&gt;
      &lt;/v20:getReportJobStatus&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre><p>
<strong>Response</strong></p><pre class="crayon-plain-tag">HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Fri, 02 Jun 2017 21:23:47 GMT
Expires: Fri, 02 Jun 2017 21:23:47 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="38,37,36,35"
Content-Length: 451

&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;requestId&gt;d52cb3a3d68af24aec2f9b0284379700&lt;/requestId&gt;
			&lt;responseTime&gt;803&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;getReportJobStatusResponse xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;rval&gt;COMPLETED&lt;/rval&gt;
		&lt;/getReportJobStatusResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
&nbsp;</p>
<h3>Call getReportDownloadURL (Get Download URL)</h3>
<p>Once you get status = COMPLETED in above API Call (i.e.  getReportJobStatus) then you ready to call getReportDownloadURL  to fetch URL which you can download.</p>
<p>Here is the API sample Request and Response</p>
<p><strong>Request</strong></p><pre class="crayon-plain-tag">POST https://ads.google.com/apis/ads/publisher/v201702/ReportService HTTP/1.1
Authorization: Bearer ya29.xxxxxxxxxxxxxxxxxxBp84ltTNyVRb9hlUEWx
User-Agent: ZappySysApp/1.0.2017.10531
Content-Type: text/xml
Accept: */*
Cache-Control: no-cache
Host: ads.google.com
Content-Length: 581
Expect: 100-continue
Accept-Encoding: gzip, deflate

&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://www.google.com/apis/ads/publisher/v201702"&gt;
   &lt;soapenv:Header&gt;
      &lt;v20:RequestHeader&gt;
         &lt;v20:networkCode&gt;238897396&lt;/v20:networkCode&gt;
         &lt;v20:applicationName&gt;ZappySysApp&lt;/v20:applicationName&gt;
      &lt;/v20:RequestHeader&gt;
   &lt;/soapenv:Header&gt;
   &lt;soapenv:Body&gt;
      &lt;v20:getReportDownloadURL&gt;
       &lt;v20:reportJobId&gt;10000297829&lt;/v20:reportJobId&gt;
       &lt;v20:exportFormat&gt;CSV_DUMP&lt;/v20:exportFormat&gt;
      &lt;/v20:getReportDownloadURL&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;</pre><p>
&nbsp;</p>
<p><strong>Response</strong></p><pre class="crayon-plain-tag">HTTP/1.1 200 OK
Content-Type: text/xml; charset=UTF-8
Date: Fri, 02 Jun 2017 21:23:49 GMT
Expires: Fri, 02 Jun 2017 21:23:49 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: quic=":443"; ma=2592000; v="38,37,36,35"
Content-Length: 1039

&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
	&lt;soap:Header&gt;
		&lt;ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;requestId&gt;8e5ac0bbeb8e88c180ea442fc5378d99&lt;/requestId&gt;
			&lt;responseTime&gt;1957&lt;/responseTime&gt;
		&lt;/ResponseHeader&gt;
	&lt;/soap:Header&gt;
	&lt;soap:Body&gt;
		&lt;getReportDownloadURLResponse xmlns="https://www.google.com/apis/ads/publisher/v201702"&gt;
			&lt;rval&gt;https://storage.googleapis.com/dfp-report-export/caxxxxxxxx-xxxxxxxxxxxxxxb?GoogleAccessId=3769xxxxxxxxxxx-qxxxxxxxxxxxxxxxxsqdb5dvi8g@developer.gserviceaccount.com&amp;amp;Expires=1496438929&amp;amp;Signature=vnhCiAIqd%2BFgWCtAHo9roFOI3W%2BveUTYuSvyBQ9gtMI2HDTXOCVDh7wzUV%2BPBJZZghaL6k8wKYq33GA4NpjZVNYuaAgPLWgGwAUPdtioHRi%2Bt3Eymp%2FAPRGIoos0ekP3O7l%2FPNPxenC6UTP087HV3j06V%2Fuui9ixpKZWGCK8r56oUPj6S8q1hG95Ns3d3sEcuz3%2BkShu6GYG5mqir5vjtZPuzwsr%2F96G5Kk123mke%2B%2FIVRJGoqnCMghNWtIG1yR1IdZx%2FIpit%2FnaJ9HP6IvAr3oMIXkQ3cHv%2FtOhXGy9dTG34q%2FKDbtkSJAayHgjlSLPGKucygcXBhUrbywBu8Y77A%3D%3D&lt;/rval&gt;
		&lt;/getReportDownloadURLResponse&gt;
	&lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;</pre><p>
<strong>Extract Single XML Node Value from SOAP API Response using XPATH</strong></p>
<p>Once you get response you can extract status of your JOB using XPAth Expression (See REST API Task response settings tab. Change Format to XML and type following XPATH expression. This will look for &lt;rval&gt;https://storage.googleapis.com/dfp-report-export/caxx&#8230;&#8230;&#8230;.&lt;/rval&gt; node anywhere in SOAP response XML and extract value (i.e. URL)</p>
<h3>Download File Using REST API Task</h3>
<p>Once you get URL its time to download it. You can use REST API Task to download the file. On Response Setting Tab specify full file path (e.g. c:\report_csv.gz) and make sure Binary option is checked (Found next to the Save Path)</p>
<h2>Making things dynamic</h2>
<p>If you want to supply certain parameters at runtime (e.g. from SSIS Variable) rather than hard code then you can use Variable Placeholders any where in Request Body, URL or Headers. Click Insert Variable option found in Edit screen</p>
<p>Here is an example of dynamic URL (API Version stored in SSIS Variable)</p><pre class="crayon-plain-tag">https://ads.google.com/apis/ads/publisher/{{User::ApiVer}}/NetworkService</pre><p>
<h2>Deployment to Production</h2>
<p>When you ready to deploy your SSIS Package to production make sure to change Test NetworkCode supplied inside Request Body to your Production Ad Network. Also Set RefreshToken Property of OAuth Connection Manager (Get it from Backup file saved when you created OAuth connection first time). Once you set RefreshToken of connection manager you won&#8217;t have to Login again to get a new token.</p>
<h2>Conclusion</h2>
<p>Traditionally if you wanted to integrate Google DFP API (DoubleClick API) calls inside your ETL workflow then it required some sort of coding effort (e.g. Use C# SDK, JAVA SDK or Python SDK). Coding effort is not only time consuming and expensive but also hard to maintain for any non-coder (e.g. ETL Developer or DBA).<br />
Thanks to <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">SSIS PowerPack</a> which changed the way developers do API integration. Now you can reduce time to implement and total cost of you API integration project significantly by using drag and drop approach. This approach is not only easy to maintain but also fast and high quality. You can use ZappySys REST/SOAP SSIS Connectors and SSIS Tasks for any API integration project such as Google DFP API. <a href="//zappysys.com/products/ssis-powerpack/" target="_blank" rel="noopener">Try SSIS PowerPack</a> for free to explore possibilities. If you have any issue with your integration <a href="//zappysys.com/support/">Contact Support</a></p>
<p>The post <a href="https://zappysys.com/blog/calling-google-dfp-api-with-ssis-doubleclick-soap-api/">How to call Google DFP API with SSIS &#8211; DoubleClick</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>How to register Google OAuth Application (Get ClientID and ClientSecret)</title>
		<link>https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/</link>
		
		<dc:creator><![CDATA[ZappySys]]></dc:creator>
		<pubDate>Sat, 09 Apr 2016 21:25:18 +0000</pubDate>
				<category><![CDATA[Google API]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[json source]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[oauth2]]></category>
		<category><![CDATA[OAuthApp]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[xml source]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=431</guid>

					<description><![CDATA[<p>Introduction In our previous article we understood little bit about OAuth 2.0 Protocol. We talked how to use Default App for ease of use. However In this post you will learn how to register Google OAuth Application so you can access various Google Services programmatically (e.g Youtube, Google Analytics, AdWords, DoubleClick etc.). Here is the [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/">How to register Google OAuth Application (Get ClientID and ClientSecret)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In our previous article we understood little bit about <a href="https://zappysys.com/blog/rest-api-authentication-with-oauth-2-0-using-ssis/" target="_blank" rel="noopener">OAuth 2.0 Protocol</a>. We talked how to use Default App for ease of use. However In this post you will learn <strong>how to register Google OAuth Application</strong> so you can access various Google Services programmatically (e.g Youtube, Google Analytics, AdWords, DoubleClick etc.). Here is the link to find all services: <a href="https://developers.google.com/oauthplayground/" target="_blank" rel="noopener">Google API Services (Using OAuth 2.0)</a></p>
<p>Recently google started supporting <a href="https://developers.google.com/identity/protocols/OAuth2" target="_blank" rel="noopener">OAuth 2.0</a> Protocol. There are many articles written explaining OAuth 2.0 protocol so we are not going to cover that in this article.</p>
<p>Following SSIS Connectors support OAuth Connectivity. When you use below connectors no coding required to pull data from OAuth enabled services.</p>
<p><strong>SSIS Tasks / Components which Supports OAuth Connection / Google API</strong></p>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/api-source/ssis-api-source.png" alt="Custom SSIS Tasks - API Source" width="32" /></td>
<td><a href="/products/ssis-powerpack/ssis-api-source/" target="_blank" rel="noopener">API Source</a></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/onlinehelp/ssis-powerpack/scr/images/google-analytics-source/ssis-google-analytics-source.png" alt="Custom SSIS Tasks - Google Analytics Source" width="32" /></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-google-analytics-source-connector/" target="_blank" rel="noopener">Google Analytics Source</a></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/SSIS-Json-Source-Adapter.png" alt="Custom SSIS Components - JSON Source (File and REST API Connector)" width="32" /></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/" target="_blank" rel="noopener">JSON Source Connector (File, REST API)</a></td>
</tr>
<tr>
<td width="36"><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" /></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-rest-api-web-service-task/" target="_blank" rel="noopener">REST API Webservice Task</a></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="//zappysys.com/images/ssis-powerpack/ssis-xml-source.png" alt="Custom SSIS Components - XML Source (File, REST, SOAP)" width="32" /></td>
<td><a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">XML Source (File, REST, SOAP)</a></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="https://zappysys.com/onlinehelp/ssis-powerpack/scr/images/web-api-destination/ssis-web-api-destination.png" alt="SSIS Web API destination" width="32" /></td>
<td><a href="https://zappysys.com/products/ssis-powerpack/ssis-web-api-destination-connector/" target="_blank" rel="noopener">Web API Destination</a></td>
</tr>
</tbody>
</table>
</div>
<p><strong>ODBC Drivers which Supports OAuth Connection / Google API (Call in Power BI, Excel, Informatica, MS Access)</strong></p>
<div class="su-table su-table-alternate">
<table>
<tbody>
<tr>
<td width="36"><img decoding="async" src="https://zappysys.com/images/odbc-powerpack/odbc-api-driver.png" alt="API ODBC Driver" width="32" /></td>
<td><a href="https://zappysys.com/products/odbc-powerpack/odbc-api-driver/" target="_blank" rel="noopener">API ODBC Driver</a></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="https://zappysys.com/images/odbc-powerpack/odbc-json-api-driver.png" alt="JSON ODBC Driver" width="32" /></td>
<td><a href="https://zappysys.com/products/odbc-powerpack/odbc-json-rest-api-driver/" target="_blank" rel="noopener">JSON ODBC Driver</a></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="https://zappysys.com/images/odbc-powerpack/odbc-xml-api-driver.png" alt="XML ODBC Driver" width="32" /></td>
<td><a href="https://zappysys.com/products/odbc-powerpack/odbc-xml-soap-api-driver/" target="_blank" rel="noopener">XML ODBC Driver</a></td>
</tr>
<tr>
<td width="36"><img decoding="async" src="https://zappysys.com/images/odbc-powerpack/odbc-csv-api-driver.png" alt="CSV ODBC Driver" width="32" /></td>
<td><a href="https://zappysys.com/products/odbc-powerpack/odbc-csv-rest-api-driver/" target="_blank" rel="noopener">CSV ODBC Driver</a></td>
</tr>
</tbody>
</table>
</div>
<h2>Create Google Project</h2>
<p>Registering OAuth App in Google first requires you to create API Project. API Project is a container which can host many OAuth Apps or other API Keys.</p>
<ol>
<li>To create API Project Visit <a href="https://console.developers.google.com/project" target="_blank" rel="noopener">https://console.developers.google.com/project</a><br />
If you already have existing API Project then once you click above link you can pick desired API Project from dropdown (Found in the top bar). If you using existing API Project then you may skip next few steps and directly move to step which explains [how to create OAuth ClientId].</li>
<li>To create new project Click on <strong>&#8220;Create Project&#8221;</strong> button. Once you click Create it will take few seconds to create project for you.
<div id="attachment_434" style="width: 394px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-new-project-for-oauth-app.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-434" class="size-full wp-image-434" src="https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-new-project-for-oauth-app.png" alt="Create New Google API Project (Google API - Register new OAuth App)" width="384" height="260" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-new-project-for-oauth-app.png 384w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-new-project-for-oauth-app-300x203.png 300w" sizes="(max-width: 384px) 100vw, 384px" /></a><p id="caption-attachment-434" class="wp-caption-text">Create New Google API Project (Google API &#8211; Register new OAuth App)</p></div></li>
<li>Now give some friendly name and change default Project ID (optional) for your project and click Create (See below).<br />
<strong><br />
NOTE:</strong> Before you click create you can <strong>change default Project ID</strong> suggested by Google by clicking <strong>Edit</strong>. This Project ID is used everywhere when calling many APIs <a href="https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query" target="_blank" rel="noopener">like this one</a> so copy this ID somewhere (You can also see this on project screen so dont worry if you miss it).Project ID is unique across google system so you may not get your preferred ID but if you can get one then its easy to remember for sure.</p>
<div id="attachment_441" style="width: 385px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-new-project-for-oauth-app-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-441" class="size-full wp-image-441" src="//zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-new-project-for-oauth-app-2.png" alt="Create new Google Api Project for OAuth App (Set project name)" width="375" height="271" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-new-project-for-oauth-app-2.png 375w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-new-project-for-oauth-app-2-300x217.png 300w" sizes="(max-width: 375px) 100vw, 375px" /></a><p id="caption-attachment-441" class="wp-caption-text">Create new Google Api Project for OAuth App (Set project name / edit default project ID)</p></div></li>
</ol>
<h2>Enable Google API for Integration</h2>
<p>Once your Project is created, next step is enable APIs you like to call. By default most Google APIs are disabled so make sure you enable each APi category manually using below steps.</p>
<ol>
<li>Once project is created it will redirect you to the API Home page where you will see many common Google API you can use.If you do not see that you can always click below option to enable API manually.Visit : <a href="https://console.cloud.google.com/apis/library" target="_blank" rel="noopener">https://console.cloud.google.com/apis/library</a>
<div id="attachment_8446" style="width: 722px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/enable-google-api-services.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8446" class="size-full wp-image-8446" src="https://zappysys.com/blog/wp-content/uploads/2016/04/enable-google-api-services.png" alt="Enable Google APIs / Services" width="712" height="418" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/enable-google-api-services.png 712w, https://zappysys.com/blog/wp-content/uploads/2016/04/enable-google-api-services-300x176.png 300w" sizes="(max-width: 712px) 100vw, 712px" /></a><p id="caption-attachment-8446" class="wp-caption-text">Enable Google APIs / Services</p></div></li>
<li>By default API you like to call might not be enabled. Search for API you wish to enable, click on the API name and <strong>click Enable</strong>.<span style="text-decoration: underline;">Some common Google API Examples:</span>
<ol>
<li>To enable <strong>Google YouTube API</strong><br />
&gt; search for &#8220;<a href="https://console.cloud.google.com/apis/library?q=youtube" target="_blank" rel="noopener">YouTube</a>&#8220;. It has few APIs so pick the one you need under this,<br />
&gt; For example To manage/view channel use Data API, for Reporting use Analytics API)</li>
<li>To enable <strong>Google Drive API</strong><br />
search for &#8220;<a href="https://console.cloud.google.com/apis/library?q=drive" target="_blank" rel="noopener">Drive</a>&#8221; and click Enable</li>
<li>To enable <strong>Google Sheets API</strong><br />
search for &#8220;<a href="https://console.cloud.google.com/apis/library?q=sheet" target="_blank" rel="noopener">Sheet</a>&#8221; (Some Sheets API operations need Drive API too see enable that as well)</li>
<li>To enable <strong>Google BigQuery API</strong><br />
&gt; search for &#8220;<a href="https://console.cloud.google.com/apis/library?q=bigquery" target="_blank" rel="noopener">BigQuery</a><strong>&#8220;</strong></li>
<li>To enable <strong>Google Analytics (GA3)</strong><br />
&gt; search <strong>&#8220;</strong><a href="https://console.cloud.google.com/apis/library?q=analytics" target="_blank" rel="noopener">Analytics</a><strong>&#8220;</strong> and enable <em>Google Analytics API</em></li>
<li>To enable <strong>Google Analytics (GA4)</strong><br />
&gt; search for <em>Google Analytics Data API</em> and click Enable, Search for <em>Google Analytics Admin API</em> and click enable (needed this to query available properties)</p>
<div id="attachment_440" style="width: 481px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/04/google-api-project-enable-api-screen.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-440" class="size-full wp-image-440" src="//zappysys.com/blog/wp-content/uploads/2016/04/google-api-project-enable-api-screen.png" alt="Enable Google API for OAuth Application Access (register Google OAuth Application)" width="471" height="356" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-project-enable-api-screen.png 471w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-project-enable-api-screen-300x227.png 300w" sizes="(max-width: 471px) 100vw, 471px" /></a><p id="caption-attachment-440" class="wp-caption-text">Search Google API for OAuth Application Access</p></div>
<p>&nbsp;</p>
<div id="attachment_439" style="width: 444px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/04/google-api-project-enable-api-screen-2.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-439" class="size-full wp-image-439" src="//zappysys.com/blog/wp-content/uploads/2016/04/google-api-project-enable-api-screen-2.png" alt="Enable Google API for OAuth Application Access (register Google OAuth Application)" width="434" height="193" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-project-enable-api-screen-2.png 434w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-project-enable-api-screen-2-300x133.png 300w" sizes="(max-width: 434px) 100vw, 434px" /></a><p id="caption-attachment-439" class="wp-caption-text">Enable Google API for OAuth Application Access</p></div>
<p>&nbsp;</li>
</ol>
</li>
</ol>
<h2>Create OAuth Credentials (Client ID / Secret)</h2>
<p>Once we create project and enable APIs our next step is to obtain OAuth ClientID / Secret. Before you can obtain that you have to configure few properties of your OAuth Consent Screen. Most fields are optional on this screen but fill out them if you plan to publish this API App for other users (i.e. Public App).</p>
<ol>
<li>Now click on the credentials tab and click &#8220;OAuth consent screen&#8221;. Fill out necessary information which will be visible to the user (such as App Name). Once you are done, continue on with credentials creation:<img loading="lazy" decoding="async" class="wp-image-9916 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/04/google-configure-api-oauth-consent-screen.png" alt="" width="806" height="906" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/google-configure-api-oauth-consent-screen.png 806w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-configure-api-oauth-consent-screen-267x300.png 267w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-configure-api-oauth-consent-screen-768x863.png 768w" sizes="(max-width: 806px) 100vw, 806px" />Google OAuth API &#8211; Create OAuth App &#8211; Set Application Name on Consent Screen</li>
<li>Click on [Create credentials] button and select OAuth Client Id option.
<div id="attachment_438" style="width: 855px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-oauth-credentials.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-438" class="wp-image-438 size-full" src="//zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-oauth-credentials.png" alt="Create OAuth Client ID Credentials for Google API access" width="845" height="519" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-oauth-credentials.png 845w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-api-create-oauth-credentials-300x184.png 300w" sizes="(max-width: 845px) 100vw, 845px" /></a><p id="caption-attachment-438" class="wp-caption-text">Create OAuth Client ID Credentials for Google API access</p></div></li>
<li>Next you will be asked to select Application Type. Pick &#8220;<strong>Desktop app</strong>&#8221; if your Application is Desktop style application. If your app is web site or running browser then pick Web Application. Click on Create and you will see your ClientID and ClientSecret which you can use during OAuth Authentication. <strong>Keep these both information secret</strong>. This is used to call OAuth Approval Screen by your Desktop App or Web App&#8230; and then user can obtain Token which can be used to call desired Google API.<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;">NOTE: Make sure you do not choose Web App and only select Desktop App. Desktop App doesnt have Redirect URL making it simple to setup and use with ZappySys software.</div></div>
<div id="attachment_9229" style="width: 732px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/create-google-oauth-credentials-new-desktop-application.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-9229" class="size-full wp-image-9229" src="https://zappysys.com/blog/wp-content/uploads/2016/04/create-google-oauth-credentials-new-desktop-application.png" alt="Create Google OAuth 2.0 Credentials - Desktop App" width="722" height="445" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/create-google-oauth-credentials-new-desktop-application.png 722w, https://zappysys.com/blog/wp-content/uploads/2016/04/create-google-oauth-credentials-new-desktop-application-300x185.png 300w" sizes="(max-width: 722px) 100vw, 722px" /></a><p id="caption-attachment-9229" class="wp-caption-text">Create Google OAuth 2.0 Credentials &#8211; Desktop App</p></div>
<div id="attachment_444" style="width: 617px" class="wp-caption alignnone"><a href="//zappysys.com/blog/wp-content/uploads/2016/04/api-client-generate-google-oauth-app-clientid-client-secret.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-444" class="size-full wp-image-444" src="//zappysys.com/blog/wp-content/uploads/2016/04/api-client-generate-google-oauth-app-clientid-client-secret.png" alt="Generate ClientID and Client Secret for Google OAuth Application (register Google OAuth Application)" width="607" height="402" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/api-client-generate-google-oauth-app-clientid-client-secret.png 607w, https://zappysys.com/blog/wp-content/uploads/2016/04/api-client-generate-google-oauth-app-clientid-client-secret-300x199.png 300w" sizes="(max-width: 607px) 100vw, 607px" /></a><p id="caption-attachment-444" class="wp-caption-text">Generate ClientID and Client Secret for Google OAuth Application</p></div></li>
</ol>
<h2>Publish App</h2>
<p>The last step in App creation is to go to the OAuth Consent Screen tab. Under Publishing Status, click PUBLISH APP to ensure your refresh token doesn&#8217;t expire often. If you plan to use the App for Private use, you do not have to worry about the Verification Status after Publishing (Which is the case for most users who access their own data).</p>
<div id="attachment_11084" style="width: 606px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/google-publish-oauth-app-refresh-token-expires-every-7-days.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11084" class="size-full wp-image-11084" src="https://zappysys.com/blog/wp-content/uploads/2016/04/google-publish-oauth-app-refresh-token-expires-every-7-days.png" alt="Publish Google App (This avoids Refresh Token Expiration every 7 days)" width="596" height="562" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/google-publish-oauth-app-refresh-token-expires-every-7-days.png 596w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-publish-oauth-app-refresh-token-expires-every-7-days-300x283.png 300w" sizes="(max-width: 596px) 100vw, 596px" /></a><p id="caption-attachment-11084" class="wp-caption-text">Publish Google App (This avoids Refresh Token Expiration every 7 days)</p></div>
<h2>Using Client ID and Client Secret in ZappySys OAuth Connection</h2>
<p>You can use generated ClientID and ClientSecret to initiate OAuth Authorization process. We are not going to cover how that works, but below is a simple screenshot of how these two pieces of information are used to call the Consent screen with some desired permission requested by calling Application:</p>
<p>ZappySys OAuth Connection can be used by many components suggested in the beginning of this article. So refer them for more information.</p>
<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" target="_blank" rel="noopener"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-6855" class="wp-image-6855 size-full" src="https://zappysys.com/blog/wp-content/uploads/2016/04/ssis-oauth-connection-manager-generate-access-token.png" alt="" 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">Google OAuth Application: Generating Access and Refresh tokens using SSIS and OAuth Connection Manager.</p></div>
<h2>Using System Default Browser to get the token</h2>
<p>If embedded browser has some issue to extract your token then you can close the window by pressing <strong>[X]</strong> in the title bar. Once you do that you will be prompted to use System Default browser to finish the token extraction. If you click Yes then Full browser will be launched.</p>
<p><strong>NOTE:</strong> Below feature is added in version published after Dec 31, 2019 (v3.0.0.11231 or later) so make sure you have latest version.</p>
<div id="attachment_8782" style="width: 570px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-flow.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8782" class="size-full wp-image-8782" src="https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-flow.png" alt="Using System Default Browser to extract OAuth Token" width="560" height="287" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-flow.png 560w, https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-flow-300x154.png 300w" sizes="(max-width: 560px) 100vw, 560px" /></a><p id="caption-attachment-8782" class="wp-caption-text">Using System Default Browser to extract OAuth Token</p></div>
<h3>Untrusted App Warning</h3>
<p>Sometimes Google might show you below warning. In order to continue the flow you might have to Click on <strong>Advanced</strong> and then click <strong>Go to YourAppName (unsafe)</strong> like below</p>
<p>&nbsp;</p>
<div id="attachment_8779" style="width: 658px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/google-oauth-app-not-trusted.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8779" class="size-full wp-image-8779" src="https://zappysys.com/blog/wp-content/uploads/2016/04/google-oauth-app-not-trusted.png" alt="How to ignore Google Unsafe App Warning (OAuth Flow)" width="648" height="455" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/google-oauth-app-not-trusted.png 648w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-oauth-app-not-trusted-300x211.png 300w" sizes="(max-width: 648px) 100vw, 648px" /></a><p id="caption-attachment-8779" class="wp-caption-text">How to ignore Google Unsafe App Warning (OAuth Flow)</p></div>
<p>&nbsp;</p>
<p><strong>OR, in some cases, you may see modern UI like below. In either case, <span style="text-decoration: underline;">choose continue</span>.</strong></p>
<p>&nbsp;</p>
<div id="attachment_11087" style="width: 524px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/google-app-not-verfied-new.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11087" class="size-full wp-image-11087" src="https://zappysys.com/blog/wp-content/uploads/2016/04/google-app-not-verfied-new.png" alt="Google App not Verified Warning (New UI)" width="514" height="397" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/google-app-not-verfied-new.png 514w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-app-not-verfied-new-300x232.png 300w" sizes="(max-width: 514px) 100vw, 514px" /></a><p id="caption-attachment-11087" class="wp-caption-text">Google App not Verified Warning (New UI)</p></div>
<p>&nbsp;</p>
<h3>Select the account</h3>
<div id="attachment_8780" style="width: 939px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-for-oauth-token-extract.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8780" class="size-full wp-image-8780" src="https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-for-oauth-token-extract.png" alt="Using System Browser" width="929" height="699" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-for-oauth-token-extract.png 929w, https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-for-oauth-token-extract-300x226.png 300w, https://zappysys.com/blog/wp-content/uploads/2016/04/use-system-browser-for-oauth-token-extract-768x578.png 768w" sizes="(max-width: 929px) 100vw, 929px" /></a><p id="caption-attachment-8780" class="wp-caption-text">Using System Browser</p></div>
<h3>Copy code and finish the flow</h3>
<div id="attachment_8786" style="width: 1135px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2017/06/manually-extract-oauth-token-use-full-browser.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-8786" class="size-full wp-image-8786" src="https://zappysys.com/blog/wp-content/uploads/2017/06/manually-extract-oauth-token-use-full-browser.png" alt="Manually Copy Code and Get OAuth Refresh / Access Token" width="1125" height="672" srcset="https://zappysys.com/blog/wp-content/uploads/2017/06/manually-extract-oauth-token-use-full-browser.png 1125w, https://zappysys.com/blog/wp-content/uploads/2017/06/manually-extract-oauth-token-use-full-browser-300x179.png 300w, https://zappysys.com/blog/wp-content/uploads/2017/06/manually-extract-oauth-token-use-full-browser-768x459.png 768w, https://zappysys.com/blog/wp-content/uploads/2017/06/manually-extract-oauth-token-use-full-browser-1024x612.png 1024w" sizes="(max-width: 1125px) 100vw, 1125px" /></a><p id="caption-attachment-8786" class="wp-caption-text">Manually Copy Code and Get OAuth Refresh / Access Token</p></div>
<p>&nbsp;</p>
<h2>Why I didn&#8217;t get refresh token back?</h2>
<p>For some reason if you just see Access token and not refresh token then try following</p>
<ol>
<li>Logout current session in browser and close all browser windows and try again</li>
<li>If you use <strong>Custom</strong> Provider rather than Google on OAuth connection then change Auth URL to include prompt and access_type like below<br />
<pre class="crayon-plain-tag">https://accounts.google.com/o/oauth2/auth?access_type=offline&amp;prompt=consent</pre>
</li>
</ol>
<h2>What to do if Google Refresh Token expires every 7 days</h2>
<p>Technically, once you have a refresh token, you should not worry about renewing as long as the API call is made atleast once every few months (max 6 months idle time). However, in some cases, your refresh token can expire sooner, and you have to click Generate Token manually</p>
<p>One main reason that is not well documented is if the Google Oauth Private App you created to access your own data is still in &#8220;<strong>testing</strong>&#8221; mode and not &#8220;<strong>published</strong>,&#8221; then as per Google, <a href="https://developers.google.com/google-ads/api/docs/get-started/common-errors">you may get this error</a>. Perform these steps to publish your app, which is in testing mode, so you do not have to renew the refresh token every 7 days.</p>
<ol>
<li>Go to your Project in Google API console<br />
Generally here</li>
<li>No API call has been made using the generated refresh_token for six months or longer<br />
<strong>SOLUTION: </strong> Make at least some API in six months to keep refresh_token active</li>
<li>Your OAuth App is in &#8220;testing&#8221; status and not published yet<br />
<strong>SOLUTION:</strong> Just click the <strong>Publish</strong> button on your App OAuth Consent screen. Do not worry about getting verified if you plan to use it for internal use; after this step, your refresh_token may not expire every 7 days <a href="https://stackoverflow.com/questions/8953983/do-google-refresh-tokens-expire" target="_blank" rel="noopener">See this thread</a>.<strong>DO NOT WORRY ABOUT GETTING VERIFIED</strong> &#8211; Just publish it to avoid refresh token expiration every 7 days.</p>
<div id="attachment_11084" style="width: 606px" class="wp-caption alignnone"><a href="https://zappysys.com/blog/wp-content/uploads/2016/04/google-publish-oauth-app-refresh-token-expires-every-7-days.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-11084" class="size-full wp-image-11084" src="https://zappysys.com/blog/wp-content/uploads/2016/04/google-publish-oauth-app-refresh-token-expires-every-7-days.png" alt="Publish Google App (This avoids Refresh Token Expiration every 7 days) " width="596" height="562" srcset="https://zappysys.com/blog/wp-content/uploads/2016/04/google-publish-oauth-app-refresh-token-expires-every-7-days.png 596w, https://zappysys.com/blog/wp-content/uploads/2016/04/google-publish-oauth-app-refresh-token-expires-every-7-days-300x283.png 300w" sizes="(max-width: 596px) 100vw, 596px" /></a><p id="caption-attachment-11084" class="wp-caption-text">Publish Google App (This avoids Refresh Token Expiration every 7 days)</p></div></li>
</ol>
<p>&nbsp;</p>
<h2>What is Google OAuth AccessToken</h2>
<p><strong>AccessToken</strong> is short lived token which you can pass along with each API Service call. once this token is expired you can get new <strong>AccessToken</strong> as long as you have obtained and saved <strong>RefreshToken</strong> (Returned to caller after very first time user go through Approval process on Consent screen). If you are using <a href="https://zappysys.com/onlinehelp/ssis-powerpack/scr/ssis-oauth-connection-manager.htm" target="_blank" rel="noopener">ZappySys OAuth connection manager</a></p>
<h2>What is Google OAuth RefreshToken</h2>
<p>May OAuth services support short lived token which expires after few minutes or hours. Google API by default expires token after 3600 seconds &#8230; So how to get new token ? Do you always go through that annoying Consent screen&#8230; what if your application is Automated Service? Well OAuth has solution for that too&#8230; its called RefreshToken.</p>
<p>First time to setup OAuth connection user have to go through Approval screen  (i.e. Consent screen) once they click Approve button they may receive two types of token (AccessToken and RefreshToken).  RefreshToken is used only when you need to get new AccessToken without going through Consent screen. So technically if OAuth supports RefreshToken (This is optional) then you can Save this piece of information in database somewhere and when you get token_expired error or you detect expiration time you can get new AccessToken without involving user consent (because you already did once).</p>
<h2>Conclusion</h2>
<p>Hope this article helped you to understand how to <strong>register Google OAuth Application</strong>. Download <a href="//zappysys.com/products/ssis-powerpack/">SSIS PowerPack</a> to try various <strong>OAuth data integration scenarios</strong> using drag and drop high performance connectors. With <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS PowerPack OAuth support</a> you can virtually pull data from any API service (<a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/">XML REST API</a> or <a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">JSON REST API</a>). Such as Facbook, Twitter, SurveyMonkey, LinkedIn and many more.</p>
<p>The post <a href="https://zappysys.com/blog/register-google-oauth-application-get-clientid-clientsecret/">How to register Google OAuth Application (Get ClientID and ClientSecret)</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Get data from Google Maps in SSIS using REST API</title>
		<link>https://zappysys.com/blog/get-data-from-google-maps-in-ssis-using-rest-api/</link>
		
		<dc:creator><![CDATA[ZappySys Team]]></dc:creator>
		<pubDate>Mon, 11 Jan 2016 15:11:49 +0000</pubDate>
				<category><![CDATA[SSIS JSON Source (File/REST)]]></category>
		<category><![CDATA[SSIS XML Source (File / SOAP)]]></category>
		<category><![CDATA[google api]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rest api]]></category>
		<category><![CDATA[ssis]]></category>
		<category><![CDATA[SSIS PowerPack]]></category>
		<category><![CDATA[xml]]></category>
		<guid isPermaLink="false">http://zappysys.com/blog/?p=305</guid>

					<description><![CDATA[<p>Full article coming soon. Meanwhile check following similar articles : SSIS XML Source (FILE, SOAP, REST API Connector) SSIS JSON Source (File, REST Connector) Read Zendesk data in SSIS using REST API Read Twitter data in SSIS using REST API Task and JSON Source – OAuth2 Protocol Get data from SurveyMonkey in SSIS using REST [&#8230;]</p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-google-maps-in-ssis-using-rest-api/">Get data from Google Maps in SSIS using REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Full article coming soon.</p>
<p>Meanwhile check following similar articles :</p>
<p><a href="//zappysys.com/products/ssis-powerpack/ssis-xml-source/" target="_blank" rel="noopener">SSIS XML Source (FILE, SOAP, REST API Connector)</a><br />
<a href="//zappysys.com/products/ssis-powerpack/ssis-json-file-source/">SSIS JSON Source (File, REST Connector)</a></p>
<p><a title="Permalink to Read Zendesk data in SSIS using REST API" href="//zappysys.com/blog/read-zendesk-data-in-ssis-call-rest-api/" rel="bookmark"><span style="color: #248cc8;">Read Zendesk data in SSIS using REST API</span></a></p>
<p><a title="Permalink to Read Twitter data in SSIS using REST API Task and JSON Source – OAuth2 Protocol" href="//zappysys.com/blog/read-twitter-data-in-ssis-using-rest-api-task-json-source-oauth2/" rel="bookmark"><span style="color: #248cc8;">Read Twitter data in SSIS using REST API Task and JSON Source – OAuth2 Protocol</span></a></p>
<p><a title="Permalink to Get data from SurveyMonkey in SSIS using REST API" href="//zappysys.com/blog/get-data-from-surveymonkey-in-ssis-using-rest-api/" rel="bookmark">Get data from SurveyMonkey in SSIS using REST API</a></p>
<p>External links</p>
<p><a href="https://developers.google.com/maps/" target="_blank" rel="noopener">Google Maps REST API Documentation</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://zappysys.com/blog/get-data-from-google-maps-in-ssis-using-rest-api/">Get data from Google Maps in SSIS using REST API</a> appeared first on <a href="https://zappysys.com/blog">ZappySys Blog</a>.</p>
]]></content:encoded>
					
		
		
			</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>
