Peggy

how to detect excel into Provisions array

1 post in this topic

7.thumb.jpg.a73ee017bef13d6114b7ffc47b3b

 

I have a excel file(),original Variable as below:

 

$aData[][] = [["Mary", 5, "Apple", "Banana", "Tomato", "Watermelon", "Strawberry"], _
              ["Sam", 3, "Apple", "Tomato", "Strawberry"], _
              ["Jack", 3, "Banana", "Watermelon", "Strawberry"]]

I want to use one Variable  to represent each Variable  as below:(Easy to expand the number)


$aData[][] = [$Name, $amount , $fruit]

 

But I don't know how to code,It really baffles me,I want to ask for your assistance~~
Thank you very very much!!!!!!!!!!
:D

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

  • Similar Content

    • dexto
      By dexto
      Why idea why would I get an error (Autoit Beta 3.3.15.0):
      Local $json[] Local $map[] $map['test'] = 'hello' Local $array[5] = [1, 2, 3, 4, 5] $json["data"] = $map $json["data"]["arr"] = $array ConsoleWrite($json["data"]["arr"][0] & @CRLF)  
    • Suneel
      By Suneel
      Hi
      I want to select an excel file from a folder using selenium. The file name includes the data stamp. But, only that file will be existing in the folder. How to do it please help with the code
    • cookiemonster
      By cookiemonster
      Im trying to read a JSON file into an array.
       
      The JSON looks like this:
       
      { "project_info": { "project_number": "123456789", "url": "https://www.website.com", "project_id": "PRJ08", "Bucket": "Buk09" }, "client": [ { "client_info": { "id": "1:1001306455", "info": { "name": "banana" } }, "oauth_client": [ { "client_id": "1001306455694-m3h6v", "client_type": 3 } ], "a_key": [ { "key": "dkldkdkd" } ], "Avail": { "ana": { "status": 1 }, "vit": { "status": 1, "other": [] }, "ad": { "status": 2 } } }, { "client_info": { "id": "1:1838346", "info": { "name": "orange" } }, "oauth_client": [ { "client_id": "2145696315633-dmdhe", "client_type": 3 } ], "a_key": [ { "key": "osikdme" } ], "Avail": { "ana": { "status": 1 }, "vit": { "status": 1, "other": [] }, "ad": { "status": 2 } } }, ], "configuration_version": "1" } What I want to do is read it all into one single large array, can anyone help? 
      All I have so far is:
      #include "JSON.au3" #include "array.au3" $file = fileread("C:\file.json") JsonToArray($file) Func JsonToArray($JSON) $JSON = StringRegExpReplace($JSON, "[\[\]{}]", "") $sBreak = StringSplit($JSON, ",") For $a = 1 To $sBreak[0] $t = _JSONDecode("{" & $sBreak[$a] & "}") _ArrayDisplay($t, "multi " & $a & " of " & $sBreak[0]) Next EndFunc ;==>JsonToArray  
    • SkysLastChance
      By SkysLastChance
      I was wondering if it is possible to make this code skip to the next row if it reads a blank line?
      I tried this.
      If $aArray = "" Then $r += 1 EndIf #include <Excel.au3> Local $r = 1 Local $aArray = _Excel_RangeRead($oWorkbook) ;~ If $iBox is greater than no. of rows in $aArray then $iBox equals the number of rows in $aArray If $iBox > (UBound($aArray) - 1) Then $iBox = UBound($aArray) - 1 For $i = 1 To UBound($aArray) - 1 ;$i =0 Start from row A If $aArray = "" Then $r += 1 EndIf $sR0 = $aArray[$i][0] ;status $sR1 = $aArray[$i][1] ;first name $sR2 = $aArray[$i][2] ;Last name $sR3 = $aArray[$i][3] ;Last 4 SSN $sR4 = $aArray[$i][4] ;DOB $sR5 = $aArray[$i][5] ;Email Address $sR6 = $aArray[$i][6] ;Mailling Address $sR7 = $aArray[$i][7] ;City $sR8 = $aArray[$i][8] ;state $sR9 = $aArray[$i][9] ;Zip Code $sR10 = $aArray[$i][10] ;Gender $sR11 = $aArray[$i][11] ;Phone WinSetState ("ADM.MCK - Registration Management Desktop","",@SW_MAXIMIZE) WinWaitActive("[CLASS:Notepad]", "", 10) ControlSend("[CLASS:Notepad]", "", "", ("{F8}")) Sleep (500) ControlSend("[CLASS:Notepad]", "", "", ("{F8}")) Sleep (500) ControlSend("[CLASS:Notepad]", "", "", ("N")) ControlSend("[CLASS:Notepad]", "", "", ("{TAB}")) Sleep (3000) ControlSend("[CLASS:Notepad]", "", "Edit1", $sR1 & @CR) Sleep (200) ControlSend("[CLASS:Notepad]", "", "", ("{TAB}")) Sleep (200) ControlSend("[CLASS:Notepad]", "", "Edit1", $sR2 & @CR) Sleep (200) ControlSend("[CLASS:Notepad]", "", "", ("{TAB}")) Sleep (200) ControlSend("[CLASS:Notepad]", "", "Edit1", $sR6& @CR) Sleep (200) ControlSend("[CLASS:Notepad]", "", "", ("{TAB}")) Sleep (200) ControlSend("[CLASS:Notepad]", "", "Edit1", $sR7 & @CR) Sleep (200) ControlSend("[CLASS:Notepad]", "", "Edit1", $sR8 & @CR) Sleep (200) ControlSend("[CLASS:Notepad]", "", "Edit1", $sR9 & @CR) Sleep (200) ControlSend("[CLASS:Notepad]", "", "Edit1", $sR11& @CR) Sleep (200) ControlSend("[CLASS:Notepad]", "", "Edit1", $sR5 & @CR) ;Email Sleep (200) ControlSend("[CLASS:Notepad]", "", "Edit1", $sR5 & @CR) ;Email Sleep (200) ControlSend("[CLASS:Notepad]", "", "", (FormatDate($sR4) & @CR)) $r += 1