---
updatedAt: 2025-11-12T23:37:08.000Z
agentTools:
  projectIndex: https://docs.sixfab.com/llms.txt
---

# Google Sheets API Usage

<div class="tags"> <span class="tag3">Advanced</span> This section will guide you step by step in creating sheets, adding data, importing, deleting and adding rows using the Google Sheet API with the Pico LTE device.</div>

<HTMLBlock>{`
<style>
.tags span{
    display: inline-block;
    margin-bottom: 0.5px;
}

.tags .tag{
   border: 1px solid #dee2e5;
   background-color: #92d050;
   border-radius: 5px;
   padding: 3px 8px;
   color: #fff;
   transition: all 300ms ease-in-out;
}

.tags .tag2{
   border: 1px solid #dee2e5;
   background-color: #f0ad4e;
   border-radius: 5px;
   padding: 6px 15px;
   color: #fff;
   transition: all 300ms ease-in-out;
}
  
.tags .tag3{
   border: 1px solid #dee2e5;
   background-color: #d9534f;
   border-radius: 5px;
   padding: 6px 15px;
   color: #fff;
   transition: all 300ms ease-in-out;
}

.tags .tag--inverse{
     background-color: #fbfbfb;
     border: 1px solid #a9b1b5;
     padding: 6px 15px;
     color: #a9b1b5;
     border-radius: 5px;
     transition: all 300ms ease-in-out;
}


.tags .tag-rounded{
     border: 1px solid #dee2e5;
     background-color: #92d050;
     border-radius: 25px;
     padding: 6px 15px;
     color: #a9b1b5;
     transition: all 300ms ease-in-out;
}


.tags .tag-rounded--inverse{
     border: 1px solid #a9b1b5;
     background-color: #fbfbfb;
     border-radius: 25px;
     padding: 6px 15px;
     color: #a9b1b5;
     transition: all 300ms ease-in-out;
  }
  
.text{
font-family: AvenirNext,sans-serif;
font-weight: 500;
letter-spacing:-0.003em;
line-height:1.5;
color:#3b3b3b;
font-size:15px;
}
.header{
font-weight: 400;
letter-spacing:-0.003em;
line-height:1.5;
color:#3b3b3b;
font-size:17px;
}

.code{
-webkit-tap-highlight-color: rgba(0,0,0,0);
line-height: 1.8em;
box-sizing: border-box;
font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
padding: 2px 4px;
font-size: 90%;
color: #c7254e;
background-color: #f9f2f4;
border-radius: 4px;
}
.ty{
color: #FCE94F;  
}
 .ty-green{
 color: #8AE234;
  }

.markdown-body .callout[theme="warning"] {
  --background: #f2dede;
  --border: #DCA7A7;
  --text: #a94445;
}
  
.markdown-body .callout[theme="info"] {
  --background: #eee;
  --border: #bebebe;
  --text: #535353;
}
    
a{
color:#4A4A4A;
}
a:hover {
  color: #57A3E8;
}

.pre {
-webkit-tap-highlight-color: rgba(0,0,0,0);
font-weight: 400;
box-sizing: border-box;
overflow: auto;
font-family: Menlo,Monaco,Consolas,Courier New,monospace;
display: block;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.42857143;
word-break: break-all;
border-radius: 4px;
background: #343434;
color: #fff;
border: none;
padding: 0 15px;
margin-bottom: 30px;
}
.pre-code {
-webkit-tap-highlight-color: rgba(0,0,0,0);
font-weight: 400;
line-height: 1.42857143;
word-break: break-all;
box-sizing: border-box;
font-family: Menlo,Monaco,Consolas,Courier New,monospace;
font-size: inherit;
white-space: pre-wrap;
border-radius: 0;
display: block;
overflow-x: auto;
color: inherit;
background: transparent;
}
.note{
color: #383d41;
background-color: #e2e3e5;
border-color: #d6d8db;
width: auto;
margin: 10px 0px;
padding:12px;
}

.ty-green{
 color: #8AE234;
  } 
.alert-note{
   background: #fcf8e3;
   background-repeat: repeat-x;
   background-position: 0 0;
   color: #8a6d3b;
   border: 1px solid transparent;
   border-color: #faebcc;
   border-radius: 3px;
   font-size: 15px;
   padding: 15px 20px;
   box-shadow: 0 2px 4px 0 rgba(0,0,0,.078);
   margin-bottom: 20px;
 }
  
.tabset > input[type="radio"] {
  position: absolute;
  left: -200vw;
}

.tabset .tab-panel {
  display: none;
}
 .pre {
-webkit-tap-highlight-color: rgba(0,0,0,0);
font-weight: 400;
box-sizing: border-box;
overflow: auto;
font-family: Menlo,Monaco,Consolas,Courier New,monospace;
display: block;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.42857143;
word-break: break-all;
border-radius: 4px;
background: #343434;
color: #fff;
border: none;
padding: 0 15px;
margin-bottom: 30px;
}
.pre-code {
-webkit-tap-highlight-color: rgba(0,0,0,0);
font-weight: 400;
line-height: 1.42857143;
word-break: break-all;
box-sizing: border-box;
font-family: Menlo,Monaco,Consolas,Courier New,monospace;
font-size: inherit;
white-space: pre-wrap;
border-radius: 0;
display: block;
overflow-x: auto;
color: inherit;
background: transparent;
}
  
.tabset > input:first-child:checked ~ .tab-panels > .tab-panel:first-child,
.tabset > input:nth-child(3):checked ~ .tab-panels > .tab-panel:nth-child(2),
.tabset > input:nth-child(5):checked ~ .tab-panels > .tab-panel:nth-child(3),
.tabset > input:nth-child(7):checked ~ .tab-panels > .tab-panel:nth-child(4),
.tabset > input:nth-child(9):checked ~ .tab-panels > .tab-panel:nth-child(5),
.tabset > input:nth-child(11):checked ~ .tab-panels > .tab-panel:nth-child(6) {
  display: block;
}


.tabset > label {
  position: relative;
  display: inline-block;
  padding: 15px 15px 25px;
  border: 1px solid transparent;
  border-bottom: 0;
  cursor: pointer;
  font-weight: 600;
}

.tabset > label::after {
  content: "";
  position: absolute;
  left: 15px;
  bottom: 10px;
  width: 22px;
  height: 4px;
  background: #8d8d8d;
}

.tabset > label:hover,
.tabset > input:focus + label {
  color: #06c;
}

.tabset > label:hover::after,
.tabset > input:focus + label::after,
.tabset > input:checked + label::after {
  background: #06c;
}

.tabset > input:checked + label {
  border-color: #ccc;
  border-bottom: 1px solid #fff;
  margin-bottom: -1px;
}

.tab-panel {
  padding: 30px 0;
  border-top: 1px solid #ccc;
}

*,
*:before,
*:after {
  box-sizing: border-box;
}

.tabset {
  max-width: 65em;
}
}


</style>
`}</HTMLBlock>

Get ready to explore the powerful combination of the Pico LTE and the Google Sheets API in this quick tutorial.  Our focus will be on leveraging the capabilities of the Pico LTE to interact with Google Sheets through the Google Sheets API. By the end of this tutorial, you'll have a clear understanding of how to add, delete, retrieve data, and even dynamically add rows to your Google Sheets spreadsheet using the Pico LTE.

Before starting this Pico LTE tutorial, the Pico LTE SDK installation and configuration steps must be completed. Below are the system requirements for this tutorial. If you haven't followed the SDK installation steps, please refer to the page below before proceeding with the tutorial. The details of these steps will not be covered in this tutorial.

<Embed url="https://docs.sixfab.com/docs/sixfab-pico-lte-micropython-sdk" title="Pico LTE SDK for MicroPython" favicon="https://files.readme.io/128ffdf-small-5cd85a2f22338b9f6dd229db478fcc574eb46f65_2_32x32.png" image="https://files.readme.io/afaa876-small-sixfab-logo-brand.png" provider="docs.sixfab.com" href="https://docs.sixfab.com/docs/sixfab-pico-lte-micropython-sdk" typeOfEmbed="default" />

<HTMLBlock>{`
<h1>System Requirements</h1>
      
<table>
<thead>
<tr>
<th>Hardware Requirements</th>
<th>Software Requirements</th>
</tr>
</thead>
<tbody>
<tr>
<td>• Sixfab Pico LTE<br>
  • Micro USB cable
  </td>
<td>• Thonny IDE</td>
</tr>
</tbody>
</table>
`}</HTMLBlock>

If you have completed all the requirements, you are ready to use Google Sheets API with the Pico LTE device.

Let's get started!

<HTMLBlock>{`
<h2>Preparing Coding Environment</h2>
<ol>      
  <li>Download the <a href="https://github.com/sixfab/picocell_python-sdk" target="_blank">Pico LTE SDK repository</a> to your local machine. If you have already downloaded it, skip this step.</li>
  <li>Open script <b>"examples → google_sheets → create_sheet.py</b> / <b>add_data.py</b> / <b>add_row.py</b> / <b>delete_data.py</b> / <b>get_data.py"</b>from the repository via Thonny IDE.</li>
  <li>If you haven't, create a <span class="code">config.json</span> file in the root directory of Pico LTE device.</li>
</ol>
`}</HTMLBlock>

<h2>Google Sheets API</h2>

<HTMLBlock>{`
<p class="header"> 1. Login to Google Cloud Console </p>
`}</HTMLBlock>

Login to Google Cloud Console with your Google account from the <a href="https://console.cloud.google.com/" target="_blank">login page</a>.

<HTMLBlock>{`
<p class="header"> 2. Create a New Project </p>
`}</HTMLBlock>

Create a project and give a name to it.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/7007e0280a1260bfc21c22c906d3a5a1a43f91cb5ba8801005e9c0163ca4ff5c-18602ae-Google_Sheets_API_Usage_with_Pico_LTE_-_1.webp" />

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/0ee131c-Google_Sheets_API_Usage_with_Pico_LTE_-_2.png" />

<HTMLBlock>{`
<p class="header"> 3. Enable Google Sheets API and Create Credentials </p> 
`}</HTMLBlock>

Select your project at first. Then, select "APIs & Services" section.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/f857f69bf790250c533bcce8fd0f60945c8abccab9b8e2b2f273ca67a7589959-520807e-Google_Sheets_API_Usage_with_Pico_LTE_-_3.webp" />

In the "Enabled APIs & services" section, press "ENABLE APIS AND SERVICES". Then, type and click "Google Sheets API" in the appeared menu.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/8deb9b2-Google_Sheets_API_Usage_with_Pico_LTE_-_4.png" />

Then, enable the Google Sheets API.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/ed99367-Google_Sheets_API_Usage_with_Pico_LTE_-_5.png" />

Press Create Credentials box.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/23e76c4-Google_Sheets_API_Usage_with_Pico_LTE_-_6.png" />

Select API as "Google Sheets API" and User data section. After that, press "Save & Continue" in scopes part with no extra operation.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/9d3a465-Google_Sheets_API_Usage_with_Pico_LTE_-_7.png" />

Fill the boxes numbered 1,2 and 3 and press "SAVE AND CONTINUE". You have to fill 2 and 3 numbered boxes with your existing Gmail address. Press create.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/6fa109d-Google_Sheets_API_Usage_with_Pico_LTE_-_8.png" />

Press "ADD OR REMOVE SCOPES"

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/42389ff-Google_Sheets_API_Usage_with_Pico_LTE_-_9.png" />

Type "spreadsheets" and select the box as below.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/ed650bf9c36548798be09ed792ead813a5a2b1124d3e87d5414390baf65efe45-375a279-Google_Sheets_API_Usage_with_Pico_LTE_-_10.webp" />

Press the box as below and click "UPDATE".

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/1742477-Google_Sheets_API_Usage_with_Pico_LTE_-_11.png" />

Press "ADD OR REMOVE SCOPES" again and type "drive" and select the box as below.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/db20e08-Google_Sheets_API_Usage_with_Pico_LTE_-_12.png" />

Press "UPDATE" and then, press "SAVE AND CONTINUE".

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/e7952dc-Google_Sheets_API_Usage_with_Pico_LTE_-_13.png" />

Select application type as "Web application". Fill the name box with your desired client name. Add "http\://localhost" and <https://developers.google.com/oauthplayground> URL to "Authorized redirect URLs" section and create it.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/71acdb0-Google_Sheets_API_Usage_with_Pico_LTE_-_14.png" />

You can download client informations using download button. In downloaded file, client id and client secret keys can be found. They will be used in next operations.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/e3f7122-Google_Sheets_API_Usage_with_Pico_LTE_-_15.png" />

In the "Enabled APIs & services" section, press "PUBLISH APP". Then, press "CONFIRM".

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/19aad62-Google_Sheets_API_Usage_with_Pico_LTE_-_16.png" />

Press 1, 2 and 3 numbered buttons respectively and create an API key. API key will be used in next operations.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/9b356c9-Google_Sheets_API_Usage_with_Pico_LTE_-_17_-_1.png" />

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/25e9cdf-Google_Sheets_API_Usage_with_Pico_LTE_-_17.png" />

<HTMLBlock>{`
<p class="header"> 4. Create Authorization Token </p>
`}</HTMLBlock>

Go to <https://developers.google.com/oauthplayground>. Follow numbered sections below and type your "Client ID" and "Client secret" keys generated before. For the client secret, click on the client name in Credentials -> OAuth 2.0 Client IDs. It is located in the Client secrets section under the Additional information tab.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/01dcde504ce7f08537f0ede4aa527572eb895a907f66d67117817cdcf8e2ec03-2aa5ae1-Google_Sheets_API_Usage_with_Pico_LTE_-_18.webp" />

Select  [https://spreadsheets.google.com/feeds/]() from the list on the left and click "Authorize APIs" button.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/46ea01b-Google_Sheets_API_Usage_with_Pico_LTE_-_19.png" />

Choose your account that is used for this operations on the appeared menu. After that, press "Advanced" and "Go to MyApp (unsafe)".

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/b8103ed6c3d97290d6b2fe266460cb9aa9be490f693597b919312d858535628a-4fdc17b-Google_Sheets_API_Usage_with_Pico_LTE_-_20.webp" />

Press "Continue".

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/fd34ce1-Google_Sheets_API_Usage_with_Pico_LTE_-_21.png" />

Press "Exchange authorization code for tokens" button.

Even if you don't press the "Exchange authorization code for tokens" button, a Refresh Token will still appear. However, it is definitely recommended to press the button to generate a new Refresh Token.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/6b49e77-Google_Sheets_API_Usage_with_Pico_LTE_-_22.png" />

In the "Exchange authorization code for tokens" section, Refresh Token can be found.

<Image alt="Sixfab Pico LTE Google Sheets API Usage" align="center" src="https://files.readme.io/8c8ef95-Google_Sheets_API_Usage_with_Pico_LTE_-_23.png" />

Finally, you attain the Refresh Token. It will be used in the next operations.

<HTMLBlock>{`
<div class="tabset">
  <input type="radio" name="tabset" id="tab1" aria-controls="marzen" checked>
  <label for="tab1">Create Sheet</label>

  <input type="radio" name="tabset" id="tab2" aria-controls="rauchbier">
  <label for="tab2">Add Data</label>

  <input type="radio" name="tabset" id="tab3" aria-controls="karlo" >
  <label for="tab3">Add Row</label>

  <input type="radio" name="tabset" id="tab4" aria-controls="janpi" >
  <label for="tab4">Delete Data</label>

  <input type="radio" name="tabset" id="tab5" aria-controls="tarpat" >
  <label for="tab5">Get Data</label>
  
  <div class="tab-panels">
    <section id="marzen" class="tab-panel">

<h2> Test the Code Example </h2>
      
<p>1. Open Thonny and create the config.json file as shown below. Use the informations you saved before.</p>

<pre><code class="rdmd-code lang-shell theme-light" data-lang="shell" name=""><button aria-label="Copy Code" class="rdmd-code-copy fa"></button><span class="cm-s-neo">{
   "google_sheets": {
      "api_key": "[API_KEY]",
      "client_id": "[CLIENT_ID]",
      "client_secret": "[CLIENT_SECRET]",
      "refresh_token": "[REFRESH_TOKEN]"
   }
}
</span></code></pre>


<p>2. Open script "examples → google_sheets → create_sheet.py" from the repository via Thonny IDE. You will see "create_sheet()" function.</p>


<blockquote class="callout callout_default" theme="info">

<h3>Parameters of create_sheet():</h3>
<p><b>sheets:</b> list, default: None</p>

<p>Name list of sheets in the new spreadsheet to be created.<br>

More than 5 values are not recommended in this list.</p>

</blockquote>

<p>3. Arrange the parameters of the create_sheet() function and run the script.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Sheet-1.png" />
<br/><br/>     


<p>4. Now, in <a href="https://docs.google.com/spreadsheets/u/0/" target="_blank">this link</a> new spreadsheet can be found.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Sheet-2.png" />
<br/><br/>     

<p>5. New sheets can be seen in the new spreadsheet.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Sheet-3.png" />
<br/><br/>     


<blockquote class="callout callout_warn" theme="🚧">

<p>After executing create_sheet() function, the new <b>"spreadsheet_id"</b> is attained and config.json is updated automatically with the new spreadsheet_id value. Therefore, you do not need to change <span class="code">config.js</span> file manually.</p>


</blockquote>



</section>
    
<section id="rauchbier" class="tab-panel">

<h4> Create a Google Sheets spreadsheet </h4>


<p>Login to Google Sheets page from <a href="https://docs.google.com/spreadsheets/" target="_blank">this link</a> and create a Google Sheets spreadsheet.</p>
    
<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Spreadsheet-1.png" />
<br/><br/>     

<p>In the image below, you can get the spreadsheet id from 1 numbered part of the url. The URL format: <b>"https://docs.google.com/spreadsheets/d/[SPREADSHEET_ID]"</b>. Spreadsheet id will be used in next operations</p>

<p>Also you can add a new sheet to spreadsheet using 2 numbered button and change the name of the sheet using 3 numbered button. Sheet name will be used in the next operations.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Spreadsheet-2.png" />
<br/><br/>

<blockquote class="callout callout_default" theme="info">
<p>You can also create a new spreadsheet with using create_sheet() function. The spreadsheet_id will be automatically added to config.json file. For details, see the 'Create Sheet' documentation.
</p>
</blockquote>




<h2> Test the Code Example </h2>


<p>Open Thonny and create the config.json file as shown below. Use the informations you saved before.</p>

<pre><code class="rdmd-code lang-shell theme-light" data-lang="shell" name=""><button aria-label="Copy Code" class="rdmd-code-copy fa"></button><span class="cm-s-neo">{
   "google_sheets": {
      "api_key": "[API_KEY]",
      "spreadsheetId": "[SPREADSHEET_ID]",
      "client_id": "[CLIENT_ID]",
      "client_secret": "[CLIENT_SECRET]",
      "refresh_token": "[REFRESH_TOKEN]"
   }
}
</span></code></pre>

<p>Open script "examples → google_sheets → add_data.py" from the repository via Thonny IDE. You will see "add_data()" function.</p>


<blockquote class="callout callout_default" theme="info">

<h3>Parameters of add_data():</h3>
<p><b>sheets:</b> str, default: None <br>
Name of your target sheet in the spreadsheet.</p>

<p><b>data:</b> list, default: None <br>
Data array to update cells. Array have to be 2 dimensional.</p>

<p><b>data_range:</b> str, default: None</p>
<p>Target cell range of the sheet. A1 Notation have to be used. For detailed information about the notation: <a href="https://developers.google.com/sheets/api/guides/concepts#cell" target="_blank">https://developers.google.com/sheets/api/guides/concepts#cell</a></p>

</blockquote>



<p>Arrange the parameters of the add_data() function and run the script.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Add-Data-1.png" />
<br/><br/>     

<p>Now, your sheet is updated with given values.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Add-Data-2.png" />
<br/><br/>     




</section>
       

<section id="karlo" class="tab-panel">

<h4> Create a Google Sheets spreadsheet </h4>


<p>Login to Google Sheets page from <a href="https://docs.google.com/spreadsheets/" target="_blank">this link</a> and create a Google Sheets spreadsheet.</p>
    
<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Spreadsheet-1.png" />
<br/><br/>     

<p>In the image below, you can get the spreadsheet id from 1 numbered part of the url. The URL format: <b>"https://docs.google.com/spreadsheets/d/[SPREADSHEET_ID]"</b>. Spreadsheet id will be used in next operations</p>

<p>Also you can add a new sheet to spreadsheet using 2 numbered button and change the name of the sheet using 3 numbered button. Sheet name will be used in the next operations.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Spreadsheet-2.png" />
<br/><br/>

<blockquote class="callout callout_default" theme="info">
<p>You can also create a new spreadsheet with using create_sheet() function. The spreadsheet_id will be automatically added to config.json file. For details, see the 'Create Sheet' documentation.
</p>
</blockquote>     



<h2> Test the Code Example </h2>


<p>Open Thonny and create the config.json file as shown below. Use the informations you saved before.</p>

<pre><code class="rdmd-code lang-shell theme-light" data-lang="shell" name=""><button aria-label="Copy Code" class="rdmd-code-copy fa"></button><span class="cm-s-neo">{
   "google_sheets": {
      "api_key": "[API_KEY]",
      "spreadsheetId": "[SPREADSHEET_ID]",
      "client_id": "[CLIENT_ID]",
      "client_secret": "[CLIENT_SECRET]",
      "refresh_token": "[REFRESH_TOKEN]"
   }
}
</span></code></pre>

<p>Open script "examples → google_sheets → add_row.py" from the repository via Thonny IDE. You will see "add_row()" function.</p>

<blockquote class="callout callout_default" theme="info">

<h3>Parameters of add_row():</h3>
<p><b>sheets:</b> str, default: None <br>
Name of your target sheet in the spreadsheet.</p>

<p><b>data:</b> list, default: None <br>
Data array to update cells. Array have to be 2 dimensional.</p>

<p><b>data_range:</b> str, default: None</p>

</blockquote>



<p>Arrange the parameters of the add_row() function and run the script.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Add-Row-1.png" />
<br/><br/>     

<p>Now, your sheet is updated with given row values.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Add-Row-2.png" />
<br/><br/>     

</section>



<section id="janpi" class="tab-panel">

<h4> Create a Google Sheets spreadsheet </h4>


<p>Login to Google Sheets page from <a href="https://docs.google.com/spreadsheets/" target="_blank">this link</a> and create a Google Sheets spreadsheet.</p>
    
<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Spreadsheet-1.png" />
<br/><br/>     

<p>In the image below, you can get the spreadsheet id from 1 numbered part of the url. The URL format: <b>"https://docs.google.com/spreadsheets/d/[SPREADSHEET_ID]"</b>. Spreadsheet id will be used in next operations</p>

<p>Also you can add a new sheet to spreadsheet using 2 numbered button and change the name of the sheet using 3 numbered button. Sheet name will be used in the next operations.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Spreadsheet-2.png" />
<br/><br/>

<blockquote class="callout callout_default" theme="info">
<p>You can also create a new spreadsheet with using create_sheet() function. The spreadsheet_id will be automatically added to config.json file. For details, see the 'Create Sheet' documentation.
</p>
</blockquote>

<h2> Test the Code Example </h2>

<p>Open your new Google Sheet spreadsheet and input some datas.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Delete-Data-1.png" />
<br/><br/>    

<p>Open Thonny and create the config.json file as shown below. Use the informations you saved before.</p>

<pre><code class="rdmd-code lang-shell theme-light" data-lang="shell" name=""><button aria-label="Copy Code" class="rdmd-code-copy fa"></button><span class="cm-s-neo">{
   "google_sheets": {
      "api_key": "[API_KEY]",
      "spreadsheetId": "[SPREADSHEET_ID]",
      "client_id": "[CLIENT_ID]",
      "client_secret": "[CLIENT_SECRET]",
      "refresh_token": "[REFRESH_TOKEN]"
   }
}
</span></code></pre>

<p>Open script "examples → google_sheets → delete_data.py" from the repository via Thonny IDE. You will see "delete_data()" function.</p>


<blockquote class="callout callout_default" theme="info">

<h3>Parameters of delete_data():</h3>
<p><b>sheets:</b> str, default: None <br>
Name of your target sheet in the spreadsheet.</p>

<p><b>data:</b> list, default: None <br>
Data array to update cells. Array have to be 2 dimensional.</p>

<p><b>data_range:</b> str, default: None</p>
<p>Target cell range of the sheet. A1 Notation have to be used. For detailed information about the notation: <a href="https://developers.google.com/sheets/api/guides/concepts#cell" target="_blank">https://developers.google.com/sheets/api/guides/concepts#cell</a></p>

</blockquote>


<p>Arrange the parameters of the delete_data() function and run the script.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Delete-Data-2.png" />
<br/><br/>     

<p>Now, your sheet is updated with deleted cells.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Delete-Data-3.png" />
<br/><br/>     

</section>

<section id="tarpat" class="tab-panel">

<h4> Create a Google Sheets spreadsheet </h4>


<p>Login to Google Sheets page from <a href="https://docs.google.com/spreadsheets/" target="_blank">this link</a> and create a Google Sheets spreadsheet.</p>
    
<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Spreadsheet-1.png" />
<br/><br/>     

<p>In the image below, you can get the spreadsheet id from 1 numbered part of the url. The URL format: <b>"https://docs.google.com/spreadsheets/d/[SPREADSHEET_ID]"</b>. Spreadsheet id will be used in next operations</p>

<p>Also you can add a new sheet to spreadsheet using 2 numbered button and change the name of the sheet using 3 numbered button. Sheet name will be used in the next operations.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Create-Spreadsheet-2.png" />
<br/><br/>

<blockquote class="callout callout_default" theme="info">
<p>You can also create a new spreadsheet with using create_sheet() function. The spreadsheet_id will be automatically added to config.json file. For details, see the 'Create Sheet' documentation.
</p>
</blockquote>

<h2> Test the Code Example </h2>

<p>Open your new Google Sheet spreadsheet and input some datas.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Get-Data-1.png" />
<br/><br/>    

<p>Open Thonny and create the config.json file as shown below. Use the informations you saved before.</p>

<pre><code class="rdmd-code lang-shell theme-light" data-lang="shell" name=""><button aria-label="Copy Code" class="rdmd-code-copy fa"></button><span class="cm-s-neo">{
   "google_sheets": {
      "api_key": "[API_KEY]",
      "spreadsheetId": "[SPREADSHEET_ID]",
      "client_id": "[CLIENT_ID]",
      "client_secret": "[CLIENT_SECRET]",
      "refresh_token": "[REFRESH_TOKEN]"
   }
}
</span></code></pre>

<p>Open script "examples → google_sheets → get_data.py" from the repository via Thonny IDE. You will see "get_data()" function.</p>


<blockquote class="callout callout_default" theme="info">

<h3>Parameters of get_data():</h3>
<p><b>sheets:</b> str, default: None <br>
Name of your target sheet in the spreadsheet.</p>

<p><b>data:</b> list, default: None <br>
Data array to update cells. Array have to be 2 dimensional.</p>

<p><b>data_range:</b> str, default: None</p>
<p>Target cell range of the sheet. A1 Notation have to be used. For detailed information about the notation: <a href="https://developers.google.com/sheets/api/guides/concepts#cell" target="_blank">https://developers.google.com/sheets/api/guides/concepts#cell</a><br><br>

If this parameter passed empty by user (not inputted), then function returns all of the data from the sheet.
</p>

</blockquote>

<p>Arrange the parameters of the get_data() function and run the script.</p>


<p>Now, data in the target cells can be seen in the shell.</p>

<img src="https://sixfab.com/wp-content/uploads/2023/10/Google-Sheets-API-Usage-with-Pico-LTE-Get-Data-2.png" />
<br/><br/>     

</section>

  </div>
  
</div>
`}</HTMLBlock>