Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Reading Excel content

$
0
0

I'm trying to read the content of my Excel. I have merge 2 standard exampel with a small modification.

 

Exampel #1 is FileOpenDialog.au3

Exampel #2 is _ExcelReadSheetToArray.au3

The excel document is a usercreation form and alot of the cells is predefined by use of a combobox.

 

The outcome is that I only get a message telling me "Press OK to Save File and Exit".

 

Do I miss something here?

AutoIt         
#include <Excel.au3> #include <Array.au3> Local $Openmessage = "Please, open Excel template for One4Al." Local $var = FileOpenDialog($Openmessage, @DesktopDir & "\", "Images (*.xlsx;*.xls)", 1) If @error Then     MsgBox(4096, "", "No File(s) chosen") Else     $oExcel = StringReplace($oExcel, "|", @CRLF)     MsgBox(4096, "", "You chose " & $oExcel)     Local $aArray = _ExcelReadSheetToArray($oExcel) ;Using Default Parameters     _ArrayDisplay($aArray, "Array using Default Parameters")     $aArray = _ExcelReadSheetToArray($oExcel, 2) ;Starting on the 2nd Row     _ArrayDisplay($aArray, "Starting on the 2nd Row")     $aArray = _ExcelReadSheetToArray($oExcel, 1, 2) ;Starting on the 2nd Column     _ArrayDisplay($aArray, "Starting on the 2nd Column")     $aArray = _ExcelReadSheetToArray($oExcel, 1, 1, 5) ;Read 5 Rows     _ArrayDisplay($aArray, "Read 5 Rows")     $aArray = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 2) ;Read 2 Columns     _ArrayDisplay($aArray, "Read 2 Columns")     $aArray = _ExcelReadSheetToArray($oExcel, 2, 3, 4, 5) ;Starting on the 2nd Row, 3rd Column, Read 4 Rows and 5 Columns     _ArrayDisplay($aArray, "Starting on the 2nd Row, 3rd Column, Read 4 Rows and 5 Columns")     $aArray = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 0, True) ;Using Default Parameters, except Shifting Column (True)     _ArrayDisplay($aArray, "Array with Column shifting")     MsgBox(0, "Exiting", "Press OK to Save File and Exit")     _ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary     _ExcelBookClose($oExcel) ; And finally we close out EndIf

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>