Is there a way to edit a Google Sheet using VBA?

I have written some VBA code that reads emails, deciphers what I need and updates (edit and insert rows) into an Excel spreadsheet. This works great but because the sheet is shared I am running into sync conflicts. These wouldn't happen if I could use my VBA to edit Excel. I am fairly confident with VBA but outside of that my skills are limited. Does anyone know of a way of achieving what I need?
LVL 1
Rob4077Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun VermaakTechnical Specialist/DeveloperCommented:
No, you need to use Google Apps Script
https://developers.google.com/apps-script/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob4077Author Commented:
Hi Shaun,

I actually found a sample (http://ramblings.mcpher.com/Home/excelquirks/exceldocsintegration/excelsheetsv4) that enable me to copy data from an Excel Sheet to a Google Sheet and back, and it does that well. Only trouble is that it is too technical for me to dissect and understand how it does it and if there is a way to read and write one line/cell at a time so I can read and check it on the way through. I don't want to run an Excel sheet and a Google sheet and try to keep them in sync, I'd rather just work with the Google sheet. I've included the code for the top level of the two functions that read and write. Of course these call other functions but I think all it's doing is copying the whole sheet in one go rather than by line.

I could use the Google script for some of what I need to do but then I run into the problem of how to read Outlook emails from Google and how to run a function I have that relies on a DLL created for use with VBA.

'// this wil get the active sheet from google
'// go can replace the active sheet name with some other sheets, or a list of sheets separated by commas
Public Sub getThisSheet()
    Dim result As cJobject
   
    '// get the data from a given sheet id, and match to the active excell sheet
    '// OAUTH2 will be taken care of if required
    Set result = getStuffFromSheets(getMySheetId(), ActiveSheet.NAME)
   
    '// success will tell us if it worked
    If (Not result.child("success").value) Then
        MsgBox ("failed on sheets API " + result.child("response").stringify)
        Exit Sub
    End If
   
    '// now write that data to the current sheet, clearing it first
    writeToSheets result.child("data").children(1).child("valueRanges"), True
   
End Sub
'// this puts the active sheet to google
'// go can replace the active sheet name with some other sheets, or a list of sheets separated by commas
Public Sub putThisSheet()
    Dim result As cJobject, clearFirst As Boolean
   
    '// set this to true if you want to always clear the sheet first
    clearFirst = True
   
    '// put the data from a given sheet id, and match to the active excel sheet
    '// OAUTH2 will be taken care of if required
    Set result = putStuffToSheets(getMySheetId(), ActiveSheet.NAME, clearFirst)
   
    '// just check that all went fine
    If (Not result.child("success").value) Then
        MsgBox ("failed on sheets API " + result.child("response"))
        Exit Sub
    End If
   
End Sub
0
Rob4077Author Commented:
Well, try as hard as I am capable and I can't get it to work the way I had hoped so, not surprisingly, you were right. Thanks for taking the time to comment.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Google

From novice to tech pro — start learning today.