Sign in to follow this  
Followers 0
Medic873

_ExcelReadSheetToArray Variable

2 posts in this topic

Here is what im doing im using the _ExcelReadSheetToArray function to pull my excell sheet and it works great but when I try to make it for example use the data put into colum 2 row 2

how do I specify that in my variable

take a look at the code im sure it will make more sense.

; ******************************************************************************************
; Example 1 - After opening a workbook and returning its object identifier,
;   Fill some cells and Read the Values into an Array, using various paramaters.
; *******************************************
#include <Excel.au3>
#include <Array.au3>
Local $oExcel = _ExcelBookOpen("C:\Users\bmmorley\Desktop\WorldShipList.xlsx")
Local $aArray = _ExcelReadSheetToArray($oExcel) ;Using Default Parameters
_ArrayDisplay($aArray, "Array using Default Parameters")

msgbox (1, "Random Pick", $aArray[2])

Share this post


Link to post
Share on other sites



_ExcelReadSheetToArray creates a two-dimensional array.

To access row 2, column 2 of your Excel sheet you have to use

msgbox (1, "Random Pick", $aArray[2][1])

The indices for arrays start with 0. But because row 0 of the array contains the row and column count the index for row 2 of your data is 2. Column 2 is index 1 because we start with 0 for columns.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0