Jump to content

read from excel database into array


Recommended Posts

Im trying to do what the title says.

In details what im trying to get is this:

i need input dialog for scanned barcode

when i scan products barcode i would like autoit to find that product in excel database

fetch data from 5 columns in that row

then display found info into array (if double code is found) or in a msgbox and copy data to clipboard for further pasting

can i get some help please?

Edited by dickjones007
Link to comment
Share on other sites

Have you tried the Excel UDF that comes with AutoIt?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

Can you please post the code you tried so far using _ExcelReadSheetToArray?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

_ExcelCopy isn't a part of Excel.au3.

Where did you find _ExcelCopy?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

now i have this:

#include <Excel.au3>
Local $oExcel = _ExcelBookOpen(@ScriptDir & 'stanjeskladista.xls')
_ExcelReadCell($oExcel,"A3:D3")
$sCellValue = _ExcelReadCell($oExcel, "A3:D3")
    MsgBox(0, "", "Value is: " & @CRLF & $sCellValue)

and i always get Value is: 0

when i add trace lines

@@ Trace(3) :    Local $oExcel = _ExcelBookOpen(@ScriptDir & 'stanjeskladista.xls')
>Error code: 1

@@ Trace(5) :    _ExcelReadCell($oExcel,"A3:D3")
>Error code: 1

@@ Trace(7) :    $sCellValue = _ExcelReadCell($oExcel, "A3:D3")
>Error code: 1

@@ Trace(9) :        MsgBox(0, "", "Value is: " & @CRLF & $sCellValue)

 

BTW i have LibreOffice. is that problem?

Edited by dickjones007
Link to comment
Share on other sites

Sure. The Excel UDF only works with - surprise - Microsoft Excel.

If you want to read a Excel workbook with LibreOffice you need the >Open Office Calc UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

What have you tried so far?
Can you post your code?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

I was trying this code and it fails

#Include <OOoCOM_UDF.au3>
#Include <File.au3>

local $FFile = @ScriptDir & "\test.xls"

local $temp_file_name = StringRegExp ($FFile,'.*\\(.*?\.[A-z]{3})',1)
local $Our_file = $temp_file_name[0], $value

$oCurCom = _OOoCalc_Attach($Our_file)
if @error or Not IsObj($oCurCom) then _
   $oCurCom = _OOoCalc_Open($FFile)

$value = _OOoCalc_ReadCell ($oCurCom, 0, 2, 1)
MsgBox(1, "AutoIt", $value)
Exit

it is from 03_CalcGetCellData.au3 file from somewhere on this forum.

i get C:\Program Files\AutoIt3\Include\OOoCOM_UDF.au3 (104) : ==> The requested action with this object has failed.:

Link to comment
Share on other sites

Using >my UDF, you can try this:

#include <OOoCalc.au3>

$FFile = @ScriptDir & "\test.xls"

$temp_file_name = StringRegExp($FFile, '.*\\(.*?\.[A-z]{3})', 1)
$Our_file = $temp_file_name[0]

$oCurCom = _OOoCalcBookAttach($Our_file)
If @error Or Not IsObj($oCurCom) Then _
        $oCurCom = _OOoCalcBookOpen($FFile)

$vValue = _OOoCalcReadCell($oCurCom, 0, 2) ; Reads cell C1
MsgBox(1, "AutoIt", $vValue)
Edited by GMK
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...