Home » excel » vba – Copy data from Google Sheet to Excel

vba – Copy data from Google Sheet to Excel

Posted by: admin May 14, 2020 Leave a comment


I want to essentially run a VBA Macro every few minutes with information from a Google Sheet. I have tried using the “Publish to web” option, but it takes more than 5 minutes to refresh due to the size of the data. I also don’t want to export or save as an Excel doc every few minutes as this needs to be automated. I also don’t want to use RPA.

I merely have a range of data in a Google Sheet that I want to transfer into Excel every few minutes.

Any ideas?

How to&Answers:

Saving/exporting to an Excel can also be automated (save to Google Drive every few mins using Apps Script Scheduled Triggers and access the file using the Drive API) but since you said you don’t seem to want to export to Excel, you could try doing the following:

  1. From VBA, access Google Sheets API ‘get values’ end-point with the range
    from where you want the data (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get) [See this thread: How do we use restful APIs from Excel macros (vba)?].
  2. Parse the JSON and save the data in your excel sheet [See this thread: JSON VBA Parse to Excel ].