Jump to content

_ExcelReadSheetToArray Variable


Recommended Posts

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])
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...