copy information from Google Sheets to Excel

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Jeffmuvans
Posts: 1
Joined: 24 Apr 2024, 11:51

copy information from Google Sheets to Excel

24 Apr 2024, 12:07

Hello, I'm writing a script to copy information from Google Sheets to an Excel file. The script copies the information from the cells and assigns it to a variable, and then pastes the information into the Excel file. The problem arises when the script copies information from an empty cell because when it pastes it into the Excel file, it interprets it as a {Enter}. How can I fix this?

Code: Select all

Send "{Ctrl down}c{Ctrl up}"
        Sleep 100
        Name2 := A_Clipboard
That is the way i assign the variable

Code: Select all

SendInput Name2
And when i try to send to the Excel, only works when the cell contains information, when the cell is empty it interprets like a {Enter}

[Mod edit: Changed topic name from 'Help with this' to a more descriptive subject.]
User avatar
rommmcek
Posts: 1478
Joined: 15 Aug 2014, 15:18

Re: copy information from Google Sheets to Excel

27 Apr 2024, 12:16

To send to the Excel try to check the length of the variable:

Code: Select all

if StrLen(Trim(Name2, '`r`n'))
    SendInput Name2

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: kunkel321, mikeyww, ntepa, robinson and 32 guests