ShrutiW Posted March 18, 2019 Share Posted March 18, 2019 Hi all, I'm trying to make an AutoIt script for our windows application ,in which I need to extract values from multiple cells in excel and use those values for inserting in the text boxes and combo boxes in the application. Can anyone please tell me how should I make it happen? Link to comment Share on other sites More sharing options...
water Posted March 18, 2019 Share Posted March 18, 2019 I suggest you have a look at the Excel UDF that comes with AutoIt. Function _Excel_RangeRead should do what you are looking for. If you need to extract a lot of cells it is best to read the whole worksheet into an array and then retrieve the needed information from the array - that's much faster compared to countless calls to _Excel_RangeRead My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 More sharing options...
Moderators Melba23 Posted March 18, 2019 Moderators Share Posted March 18, 2019 (edited) Moved to the appropriate forum. ShrutiW, I am getting tired of moving your threads in to the correct section - you might find them vanishing in the future if you continue posting in inappropriate places. M23 Edited March 18, 2019 by Melba23 Made it personal Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ShrutiW Posted March 20, 2019 Author Share Posted March 20, 2019 (edited) Hi @water, Thanks for the help, I have used excel UDF and now I am able to read the whole excel sheet. But I am stuck in the next part, where I have to choose particular values from cells , say- Now I have to choose the row 1, I need values from cells- E1, F1, G1, P1 and R1 , and then retrieving these values and sending them to text boxes and combo boxes of another script. I tried searching for it but no luck. Can you please help me in this please? Just posting the screenshot for better understanding . As there are multiple columns with headings like member Id , Inquire for .etc., What I want is, I need to check the first row, in which I will check for member Id first , and then check for next columns i.e. Inquire for and inquired about, if those fields contains yes, then retrieve that member Id, and paste it in another script (in the textbox field). Next going further, I will check for Inquiry type and contact type, will retrieve the values in the cells and selecting the given value matching with the comboBox in another script. I am not getting any idea how to do it. 😑 Please help? Edited March 20, 2019 by ShrutiW Link to comment Share on other sites More sharing options...
ShrutiW Posted March 20, 2019 Author Share Posted March 20, 2019 Hey @Melba23, Sorry for posting in the inappropriate place.. Could you please suggest me a correct path to post my queries? Link to comment Share on other sites More sharing options...
water Posted March 20, 2019 Share Posted March 20, 2019 Let's say you have read the whole worksheet into an array named $aUsedRange (and the used range in the sheet starts with column "A") then you will find the data you mentioned in $sE1 = $aUsedRange[0][4] ; Cell E1 $sF1 = $aUsedRange[0][5] ; Cell F1 ... ShrutiW 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 More sharing options...
FrancescoDiMuro Posted March 20, 2019 Share Posted March 20, 2019 @ShrutiW If you use _Excel_RangeRead() that reads the UsedRange from E to R columns, the function returns a 2-Dimension array, which you can iterate through, and extract only the values you're interested of. On the other side, if you only need to extract 5 values (E1, F1, G1, P1 and R1), use _Excel_RangeRead() specifying the cells you want to read, and you're done. 18 minutes ago, ShrutiW said: Could you please suggest me a correct path to post my queries? From the Forum Etiquette: Quote forum. AutoIt Specific General Help and Support (Most support questions) GUI Support (Support for the Graphical User Interface) AutoItX Support (Support for the COM, DLL, PowerShell and .NET add-ons for AutoIt) Non-AutoIt Chat Developer Chat ShrutiW 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
ShrutiW Posted March 27, 2019 Author Share Posted March 27, 2019 (edited) Hi @water, I tried using usedRange function, but I am not getting how do I send the parameters retrieved from the cells in the another script? I am not getting any clue. I have written a draft code, Can you please suggest me changes on how do I send values in particular cells to another script, and how will call the values in the new script , I use those values at runtime? 😞 ; Read the formulas of a cell range (all used cells in column A:R) Local $aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("1:18"), 1) _ArrayDisplay($aResult, "Excel UDF: _Excel_RangeRead Example 3 - Formulas in the worksheet.") Local $sE1=0 $aUsedRange = _Excel_RangeRead($oWorkBook) If $sE1 = $aUsedRange[0][17] Then Local $aResult1 = _Excel_RangeRead($oWorkbook, 1, "E2", 2) ; Read the Member Id and send it to the text boxex in another script ElseIf $sF1 = $aUsedRange[0][5] And $sG1 = $aUsedRange[0][6] Then Local $aResult2 = _Excel_RangeRead($oWorkbook, 1, "F1,G1", 2) ;If cell contains "Yes" then select a value from dropdown EndIf Edited March 27, 2019 by ShrutiW Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted March 27, 2019 Share Posted March 27, 2019 20 minutes ago, ShrutiW said: how do I send the parameters retrieved from the cells in the another script? Another AutoIt script? If so, you could use Command Line parameters to pass values to the other script. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
water Posted March 27, 2019 Share Posted March 27, 2019 Or you could use IPC (Inter Process Communication) to pass data between two scripts. UDFs to implement IPC can be found here: https://www.autoitscript.com/wiki/User_Defined_Functions#Inter_Process_Communications My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now