Jump to content

Recommended Posts

Posted

Hi there, I'm looking for infomation using AutoIT control Google Sheets (The same Excel).

Anyone have experience about AutoIT control Google Sheets ? 

API or Anyway to control Google Sheets is still ok.


 

Posted (edited)

You will need to use Google sheet API : 

https://developers.google.com/sheets/api/samples?hl=en

But before you can use the API, you will need to enable the access with credentials :

https://developers.google.com/workspace/guides/get-started?hl=en

I just tested it and it works fine (although I have no experience with it before)

Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
Local $url = "https://sheets.googleapis.com/v4/spreadsheets/SHEET ID FOUND IN URL/values/A1:B3?key=KEY OBTAINED FROM GOOGLE"
; Initialize an HTTP request.
$oHTTP.Open("GET", $url, False)
$oHTTP.send()
; Get response text
Local $sResponse = $oHTTP.ResponseText
Sleep(500)
ConsoleWrite($sResponse & @CRLF)

Response is in JSON :

Spoiler
{
  "range": "'Feuille 1'!A1:B3",
  "majorDimension": "ROWS",
  "values": [
    [
      "1",
      "a"
    ],
    [
      "2",
      "b"
    ],
    [
      "3",
      "c"
    ]
  ]
}

 

ps. one last thing I forgot to tell you, you will need to publicly share your spreadsheet in order to grant access to your scripts.

Edited by Nine
  • 4 months later...
Posted

Hi Nine, Sorry late reply. I read you post for a long time ago, but I dont understand. And a few weeks ago, I ask this topic again on Vietnam Auto IT Group on Facebook. A guys name Hung sent me this https://github.com/aipit2/Google-Sheet-API  

He has full example. And video introduce How to create new API on Google Sheet.

 

This code is very helpful. Please check it. 

=====

And now, I have new question. How to use Find and Replace on Google Sheet with AutoIT ? 

 

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...