Jump to content

Export data to Excel using AUTOIT


Mosses
 Share

Recommended Posts

What have you tried so far?

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 tried this

$q_dsl="";
$var = "C:\Users\ZJMD2860\Desktop 1.xlsx"
Func Check_Fichier()
$f_vp = FileOpen($var, 0)
If $f_vp = -1 Then
    MsgBox(0, "Erreur", "Impossible d'ouvrir le fichier : " & $f_vp )
    Return 0
    Exit
EndIf
;~ $q_dsl = StringUpper(InputBox("Reprise ?", "Saisir un DSLAM de reprise si besoin." & @CRLF & @CRLF & "Sinon cliquez CANCEL OU ESC pour TOUT traiter.", "", " M8"))
;~ $q_pop = StringUpper(InputBox("PoP ?", "Saisir le nom du POP pour le suivi : .", "", " M3"))
;~ $q_dsl = ""
;~ $q_pop = 'BOR'
; Comptage nombre de lignes
Global $ligne = 0 ; n° ligne active
Global $nbr_ligne = 0 ; Nbr de ligne à traiter
While 1
    $l_vp = FileReadLine($f_vp)
    If @error = -1 Then ExitLoop
    $ls_vp = StringSplit($l_vp, ";")
    If StringLeft($ls_vp[1],2) = "NM" Then Global $q_pop = StringMid($ls_vp[1],3,3)  ;Saute la 1ère ligne des champs
    If StringLeft($ls_vp[1],2) = "DS" Then $nbr_ligne = $nbr_ligne + 1  ;Saute la 1ère ligne des champs
    If StringInStr(StringUpper($l_vp),StringUpper($q_dsl)) Then Global $q_dsl_ok = 1  ;Saute la 1ère ligne des champs
    If StringInStr(StringUpper($l_vp),StringUpper($q_dsl)) Then Global $ligne = $nbr_ligne  ;Saute la 1ère ligne des champs
Wend
FileClose($f_vp )
Return 1
EndFunc


but didn't open anything

Link to comment
Share on other sites

i tried also this

include <Array.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>

; Create application object and open an example workbook
Local $oExcel = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "Z:\Stage2016\1.xlsx")
If @error Then
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error opening workbook '" & @ScriptDir & "Z:\Stage2016\1.xlsx'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_Close($oExcel)
    Exit
EndIf

; *****************************************************************************
; Read data from a single cell on the active sheet of the specified workbook
; *****************************************************************************
Local $sResult = _Excel_RangeRead($oWorkbook, Default, "A1")
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 1", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example 1", "Data successfully read." & @CRLF & "Value of cell A1: " & $sResult)

 

Link to comment
Share on other sites

Looks good. So the Excel part is solved now?

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

_Excel_RangeRead writes the single cell to variable $sResult.
How to write this variable to your application depends on the application. Is it a Web application or a GUI?

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

Which browser do you run?

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 want to delete same value for my application

iwrite the code for delete its ok but i should put the variable with my hand

and a have 50 variable in excel i wwant take those variable ant put it my application and delete them

Link to comment
Share on other sites

hi thank you for you

i still have probleme

this is my script

 #include <Excel.au3>

#include <IE.au3>

; TO ADD PREFFERED HOTELS FOR A CORPORATE ACCT, JUST CHANGE THE FOLLOWING TWO LINES

; THE URL AND CELL RANGE ARE ALL YOU NEED TO CHANGE AND BE SURE TO

; PUT YOUR EXCEL FILE IN YOUR SCRIPT DIRECTORY AND NAME IT HOTEL_LIST.XLS

;

$corporate_URL = "http://dvedvr44.rouen.francetelecom.fr:9013/ner-training/app/homepage"

$cell_range = "A1:A560"

$FilePath=@ScriptDir & "\1.xlsx"

$hotel_array =_Excel_RangeRead($FilePath,1,$cell_range) ; 1 means sheet 1

$nbr_hotels = UBound($hotel_array)-1 ; stores # of hotels

$oIE = _IEAttach ("eAdvantage help desk", "text")

_IENavigate ($oIE, $corporate_URL)

_IELoadWait ($oIE) ; wait til page loads completely
Func _Main()
    Global $oIE = _IECreate("www.vvv.com", 1)

    _IELoadWait($oIE)
    if WinActive('Log On - Microsoft Internet Explorer - company') = True Then
        MsgBox($MB_SYSTEMMODAL, "", "Exists", 1)
        ConsoleWrite("Exists" & @CRLF)
        WinActivate('Log On - Microsoft Internet Explorer - company')
        Signin($oIE)
    Else
        ;MsgBox($MB_SYSTEMMODAL, "", "Do not exists", 1)
        Global $oIE = _IECreate("http://dvedvr44.rouen.francetelecom.fr:9013/ner-training/app/homepage", 1)
        ConsoleWrite("Do not exists" & @CRLF)
        _IELoadWait($oIE)
        WinActivate('Log On - Microsoft Internet Explorer - company')
        Signin($oIE)
    EndIf
EndFunc

Func Signin(ByRef $oIE)
     Local $user_name = _IEGetObjById($oIE, "nom")
    _IEFormElementSetValue($user_name, "adm", 0)

    Local $password = _IEGetObjById($oIE, "password")
    _IEFormElementSetValue($password, "adm", 0)

$oTDs = _IETagnameGetCollection($oIE, "TD")
$oButtons = _IETagNameGetCollection ($oIE, "INPUT")
    For $oButton In $oButtons
        If $oButton.type = "submit" Then
            _IEAction ($oButton, "click")
            ExitLoop
        EndIf
    Next

Local $pa = _IEGetObjById($oIE, "id2")
    _IEFormElementSetValue($pa, "yee", 0)
$bouton = _IEGetObjById ($oIE, "id12")
_IEAction ($bouton, "click")
sleep(2000)

EndFunc

 

Link to comment
Share on other sites

Please define "I still have problems".
Does your script crash? How far do you come? Does the login work?

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

  • Developers
12 minutes ago, oulaya said:

,,,,,?????

Meaning what?
Don't tell me you expected an answer within 40 minutes  ...right?

Jos 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@oulaya

Please read this:  * How to post code on the forum *

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

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...