How to copy Excel rows and process data

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
omar
Posts: 540
Joined: 22 Oct 2015, 17:56

How to copy Excel rows and process data

19 Feb 2019, 10:19

I will copy into Clipboard 100 rows of data with 4 columns from Excel.

I want to process the data 1 row at a time.
How do I process the data? How do I store in an array?

I've done before for reading in files and from the Clipboard.
I'm thinking it will be different reading from Excel - what will the delimeter be?

Thanks.
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: How to copy Excel rows and process data

21 Feb 2019, 06:45

Hi Omar,
You can search the forum but this https://github.com/tmplinshi/ExcelToArray it meets
Donec Perficiam
User avatar
sinkfaze
Posts: 616
Joined: 01 Oct 2013, 08:01

Re: How to copy Excel rows and process data

21 Feb 2019, 09:52

If you copy the range to the Clipboard, you can use two parsing loops: first one by newline, second by tab.

Code: Select all

Loop, Parse, Clipboard, `n, `r
	Loop, Parse, A_LoopField, `t
		MsgBox %	A_LoopField
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: How to copy Excel rows and process data

21 Feb 2019, 13:46

omar wrote:
19 Feb 2019, 10:19
I will copy into Clipboard 100 rows of data with 4 columns from Excel.

I want to process the data 1 row at a time.
How do I process the data? How do I store in an array?

I've done before for reading in files and from the Clipboard.
I'm thinking it will be different reading from Excel - what will the delimeter be?

Thanks.

You don't have to use the Clipboard with Excel.

Through COM there are lots of easy ways to access the values in a Range of Cells.

Here is a simple example:

Code: Select all

xlApp := ComObjActive("Excel.Application")

for Cell in xlApp.Range("A1:B2")
	MsgBox % Cell.Value
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: hiahkforum, NullRefEx, ShatterCoder and 92 guests