
ADODB: UPDATE Excel from Access database
By
robertocm, in AutoIt Example Scripts
-
Recently Browsing 0 members
No registered users viewing this page.
-
Similar Content
-
By Cristin
Dear all,
first of all hi.
I`m in trouble, again 😕
I can`t find right solution, tried all possible combinations generated by my mind and nothing.
I need to copy range of values depending by values from two different cells in excel sheet.
I put an example in attachment.
I have two values which is never changed (is changed only TEXT). I need to copy all the rows from VALUE 1 to VALUE 2 in new Sheets (Output 1, Output 2, ... , Output X).
It is possible to do this using Autoit? 🤔
Also in attachment you can find last example which I have tried and it`s something near, it is copying by _Excel_RangeFind row with needed VALUE 1 but I need to copy whole range from VALUE 1 to VALUE 2 😵 ( see in attachment examples).
Thank you very much, in advance, for your support, solution really will make my life much easier 🙃
Have a nice day all of you!
Best Regards,
Cristin
Book1.xlsx something.au3
-
By mLipok
I want to present BETA Version of my ADO.au3 UDF.
This is modifed version of _sql.au3 UDF.
For that I want to thanks : ; Chris Lambert, eltorro, Elias Assad Neto, CarlH
This is first public release , and still is as BETA
DOWNLOAD LINK (in download section):
Have fun,
mLipok
EDIT: 2016-06-03
Below some interesting topics about databases:
EDIT 2016/07/04:
For more info about ADO look here:
https://www.autoitscript.com/wiki/ADO
FOR EXAMPLE DATABASE use AdventureWorksDW2016_EXT.bak from:
https://github.com/microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2016_EXT.bak
I will relay on this database in my examples.
-
By WindIt
Hi,
I have a set of excel docs 1& 2
1) In Excel 1 i have a fixed column called dimensionId that contains list of dimensionid's with in between empty cells.
Here, For each dimesionId, i need to check corresponding columns of L,M,N ,O(senior, mid, junior, student) & check If they contain letter Y (Open excel 2) and if empty ignore,check next.
I need to loop through the entire column of dimensionId one by one, please help me proceed with the logic.
2) If letter Y exists, open excel 2 and check if same dimesionId exists in column A.
New to autoit excel automation, Help me with logic to execute this.
#include <Excel.au3>
Global $oExcel = _Excel_Open()
Global $oWorkbook = _Excel_BookOpen($oExcel, "D:\yta\Trial concept dimensions list.xlsx")
Local $read1 = _Excel_RangeRead ($oWorkbook,Default,"C3")
MsgBox(0,"",$read1)
Attached exce 1 doc.
exl1.xlsx exl2.xlsx
-
By Zaoka
Hi,
is it possible to break link in active/open $oWorkbook0 with excel.udf function ? If some could link some example...
Data-Edit Links-Break Link
-
By chaddro
First post, be gentle
I am working on a script that will eventually run via a batch file with Task Scheduler.
The purpose of the script is to query SQL Server and save the results as .xlsx files. However, when I run the script either from the editor or compiled file, the excel windows open and I have to close them for the script to continue. I did not have this issue initially, the excel windows would open and then close on their own.
Below is code from one section of the script where I am creating my spreadsheets. This code creates a single spreadsheet with a list of invoices for that day:
; Query SQL Server for List of Invoices dated $aDocumentDate $iReturnVal1 = _SQL_GetTable2D(-1,$aQuery,$aData,$iRows,$iColumns) If $iReturnVal1 = $SQL_OK Then ; Display Query Results in Array ; _arrayDisplay($aData,"2D (" & $iRows & " Rows) (" & $iColumns & " Columns)" ) ; Create Excel file name based on date of query $excelFileNameList1 = "C:\pride\daily\invoices_" & $aDocumentDate & ".xlsx" ; Open Existing or Create .xlsx file Local $oExcel_1 = _Excel_Open(False) Local $oWorkbook = _Excel_BookNew($oExcel_1, 1) ; Write Query results to Excel Spreadsheet and save _Excel_RangeWrite($oWorkbook,Default, $aData, "A1", True, True) _Excel_BookSaveAs($oWorkbook, $excelFileNameList1, Default, True) ; Close the book and close Excel handle _Excel_BookClose($oWorkbook, True) _Excel_Close($oExcel_1) EndIf This code then creates a separate spreadsheet for each invoice and saves:
;============[ $aData holds list of Invoices Local $aInvoiceNumber ; Invoice Number for Query Local $aData2, $iRows2, $iColumns2 ; Read Query from file to save space here.... WORKING ... query must all be on one line! Local $aQueryFromFile = FileRead("c:\pride\invoice.sql",FileGetSize("c:\pride\invoice.sql")) Local $aQuery2 For $i = 1 to $iRows $aInvoiceNumber = $aData[$i][0] ; invoice number to query $aQuery2 = $aQueryFromFile & $aInvoiceNumber & ";" ; Display query to console ; ConsoleWrite(@lf & $aQuery2 & @lf) ; Get Invoice Data $iReturnVal2 = _SQL_GetTable2D(-1,$aQuery2,$aData2,$iRows2,$iColumns2) If $iReturnVal2 = $SQL_OK Then ; show query result ;_arrayDisplay($aData2,"2D (" & $iRows2 & " Rows) (" & $iColumns2 & " Columns)" ) ; check invoice file name ;ConsoleWrite(@LF & "Data for invoice: " & $aInvoiceNumber & @LF) ; Create file name for invoice spreadsheet $excelFileName2 = "C:\pride\invoices\invoice_" & $aInvoiceNumber & ".xlsx" ; Open Existing or Create .xlsx file Local $oExcel_2 = _Excel_Open(False) ; create excel instancee Local $oWorkbook2 = _Excel_BookNew($oExcel_2, 1) ; Create new workbook with 1 sheet ; Write query results to Excel Sheet ; Note: we must use $bforceFunc TRUE to bypass Excel Limitations _Excel_RangeWrite($oWorkbook2, $oWorkbook2.Activesheet, $aData2, "A1", True, True) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite ", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel_2) Exit EndIf _Excel_BookSaveAs($oWorkbook2, $excelFileName2, Default, True) _Excel_BookClose($oWorkbook2, True) _Excel_Close($oExcel_2) EndIf Next One thing to note: I am using $bForceFunc = True in _Excel_RangeWrite because I may have strings longer than 255 character. Also, I am using Office 2010 if that matters. I am also compiling for command line.
Pardon the diagnostic code, this is my first autoit script
Thank you in advance for your help!
-