Dimmae Posted November 20, 2017 Posted November 20, 2017 (edited) Hello, at first: i'm new here, so please forgive me my mistakes, and show them to me, just that i can learn to do better in the future. Now to my Problem: i have an excel sheet, where i just need some columns for further actions, but i have no idea how to add single columns to a new array. I found the following code(the one i just added as a file) from 'water' in this forum, but i wont get how i could add multiple columns into a new array. The biggest problem in my situation is that i dont know the count of the rows i need for the array, i just got a fix number of rows, which is 4. Hope you can help me, and sry again for this 'unlucky illustration'. btw: how can i add code shown as code here, instead of posting it as a attached file?. autoit-select-column.au3 defects.xlsx Edited November 20, 2017 by Dimmae Failed with text input, just trying to get things in order
Moderators JLogan3o13 Posted November 20, 2017 Moderators Posted November 20, 2017 @Dimmae welcome to the forum. Rather than adding the columns in one at a time, you could always just used the "UsedRange" feature in Excel and grab the whole thing: #include <Array.au3> #include <Excel.au3> Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, @DesktopDir & "\defects.xlsx") Local $aRange = _Excel_RangeRead($oWorkbook, Default, $oExcel.ActiveSheet.UsedRange) _ArrayDisplay($aRange) _Excel_BookClose($oWorkbook) _Excel_Close($oExcel) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Dimmae Posted November 20, 2017 Author Posted November 20, 2017 (edited) ah thanks @JLogan3o13, it worked wonderfully, and that's a lot easier than i thought. I might have been too deep in my problem to see this simple solution, thanks! but i had to change the 'DesktopDir' to 'ScriptDir' or i would run into an error. Edited November 20, 2017 by Dimmae
Juvigy Posted November 20, 2017 Posted November 20, 2017 6 minutes ago, Dimmae said: ah thanks @JLogan3o13, it worked wonderfully, and that's a lot easier than i thought. I might have been too deep in my problem to see this simple solution, thanks! but i had to change the 'DesktopDir' to 'ScriptDir' or i would run into an error. This is because your excel file is not in the desktop dir , but somewhere else.
Dimmae Posted November 20, 2017 Author Posted November 20, 2017 Just now, Juvigy said: This is because your excel file is not in the desktop dir , but somewhere else. yes that makes sense thanks
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