CiaronJohn Posted November 20, 2019 Share Posted November 20, 2019 Hi AutoITers, I have a basic question, I have an excel worksheet with a lot of data in it, but I only want to acquire the data of the entire ROW? Is there any possible way to do this? I tried using _Excel_RangeRead with parameter of ROW but no value was acquired. Func doCountermeasure() Local $oExcel = _Excel_Open(False) Local $testdesign = _Excel_BookOpen( $oExcel, StringTrimLeft(FileReadLine ( $errorlogFile, 2 ), 20), True, True ) ;open test sheet loaded in FSUnit tool Local $aWorkSheets = _Excel_SheetList($testdesign) ;list worksheets of the test design Local $file = @ScriptDir & "\TempFile.txt" ;create temporary text file FileOpen($file, 2) Local $worksheets = _FileWriteFromArray ( $file, $aWorkSheets ) ;populate text file with name of worksheets Local $aInput _FileReadToArray($file, $aInput) For $i = 3 to UBound($aInput) - 2 ;loop to different worksheets ;MsgBox (0,'',$aInput[$i])StringTrimRight( $aInput[$i], 1) Local $factors = _Excel_RangeRead ( $testdesign, StringTrimRight( $aInput[$i], 1), "E26") ;gather data from row E26 of each worksheets _ArrayDisplay ($factors) Next _Excel_BookClose ( $testdesign ) ;FileDelete( $file ) EndFunc Thank you! Link to comment Share on other sites More sharing options...
CiaronJohn Posted November 20, 2019 Author Share Posted November 20, 2019 Just now, CiaronJohn said: Hi AutoITers, I have a basic question, I have an excel worksheet with a lot of data in it, but I only want to acquire the data of the entire specific ROW? Is there any possible way to do this? I tried using _Excel_RangeRead with parameter of ROW but no value was acquired. Func doCountermeasure() Local $oExcel = _Excel_Open(False) Local $testdesign = _Excel_BookOpen( $oExcel, StringTrimLeft(FileReadLine ( $errorlogFile, 2 ), 20), True, True ) ;open test sheet loaded in FSUnit tool Local $aWorkSheets = _Excel_SheetList($testdesign) ;list worksheets of the test design Local $file = @ScriptDir & "\TempFile.txt" ;create temporary text file FileOpen($file, 2) Local $worksheets = _FileWriteFromArray ( $file, $aWorkSheets ) ;populate text file with name of worksheets Local $aInput _FileReadToArray($file, $aInput) For $i = 3 to UBound($aInput) - 2 ;loop to different worksheets ;MsgBox (0,'',$aInput[$i])StringTrimRight( $aInput[$i], 1) Local $factors = _Excel_RangeRead ( $testdesign, StringTrimRight( $aInput[$i], 1), "E26") ;gather data from row E26 of each worksheets _ArrayDisplay ($factors) Next _Excel_BookClose ( $testdesign ) ;FileDelete( $file ) EndFunc Thank you! Link to comment Share on other sites More sharing options...
Nine Posted November 20, 2019 Share Posted November 20, 2019 use .EntireRow method. See here. CiaronJohn 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
CiaronJohn Posted November 20, 2019 Author Share Posted November 20, 2019 Hi Nine, I already tried that, but all i got is '0'. Link to comment Share on other sites More sharing options...
argumentum Posted November 20, 2019 Share Posted November 20, 2019 save as CSV and read the line you wanna get CiaronJohn 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
CiaronJohn Posted November 20, 2019 Author Share Posted November 20, 2019 Hi argumentum, Thank you. But I have multiple worksheets in a file. So, I think it will be harder to gather necessary data from that. Link to comment Share on other sites More sharing options...
water Posted November 20, 2019 Share Posted November 20, 2019 The .EntireRow method is the way to go. Please post the code you used that does not work. 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...
CiaronJohn Posted November 20, 2019 Author Share Posted November 20, 2019 Hi water, We figured the problem out using this; $testdesign.sheets($i).Cells(27,$irows). But my problem now is on how to determine the last row with entry. Link to comment Share on other sites More sharing options...
CiaronJohn Posted November 20, 2019 Author Share Posted November 20, 2019 Hi water and Nine, My problems are solved. Thanks to the excel UDF! Mabuhay from PH! Link to comment Share on other sites More sharing options...
water Posted November 20, 2019 Share Posted November 20, 2019 One last comment: The wiki is a good source: https://www.autoitscript.com/wiki/Excel_Range#Entire_Row_.2F_Entire_Column CiaronJohn 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...
CiaronJohn Posted November 22, 2019 Author Share Posted November 22, 2019 Hi @water, I have a question sill regarding this topic. Is there any possible way to extract data under "Expected values" column? Row 24 by the way are merged cells per sections. Thank you! Link to comment Share on other sites More sharing options...
water Posted November 22, 2019 Share Posted November 22, 2019 Simply use _Excel_RangeRead to read this 4 columns. Merged cells will be returned in the leftmost cell of the array. Means: You read columns K:N the string "expected values" would be returned in row 23, column 0 of the returned array. CiaronJohn 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...
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