Jump to content

Help With _Excel_RangeWrite() function


Go to solution Solved by water,

Recommended Posts

I had been Lately Writing Code to Write Data array to Excel

Using this Function is not giving error also Not giving any result

Someone Can Please Guide me 

Attaching Sample Code(Main Code is too Big)

 

    $resultS=Taxpower_query('SELECT * FROM ChallanDetails'); This is Ado Connection; Array display i m attaching here for your Reference to Understand data
    _ArrayDisplay($resultS)
    Local $oExcel = _Excel_Open()
    Local $oWorkbook = _Excel_BookNew($oExcel);Excel workbook and Worksheet opens properly
    $data=_Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $resultS,"A1")
    MsgBox(0,0,$data &@crlf&@error)

195651152_AutoitForumexcelerror.thumb.jpg.cac1512656166e0fcc9c31785c89acf6.jpg

508997325_AutoitForumexcelerror2.jpg.bff339841ccfbd1c7112894c8b7aef7b.jpg

Not Able to figure out where i m going wrong.

is it because of large data size or something else.

Please let me know where i m going wrong

Link to comment
Share on other sites

I did a quick test with a small array that I created myself and your code works. In the past, if I had errors with the Excel UDF, I would have trouble with Excel working properly. I would have to go into the Task Manager, kill the Excel process, open Excel, close Excel - and then my script would start working again. I say it's worth trying.

Link to comment
Share on other sites

17 minutes ago, abberration said:

I did a quick test with a small array that I created myself and your code works. In the past, if I had errors with the Excel UDF, I would have trouble with Excel working properly. I would have to go into the Task Manager, kill the Excel process, open Excel, close Excel - and then my script would start working again. I say it's worth trying.

I Jus tried the same multiple times.I have Nothing Open as i freshly started the computer.Also the same piece of code works with another data set.

Also Excel sheet is getting opened but there is no data getting populated.

It feels like Some Limitation on amount of data that can be writted using the function.

as even @error is blank

Edited by n3wbie
Added Other Useful information that could be of use for debugging
Link to comment
Share on other sites

  • Solution

Please set parameter ForceFunc of _Excel_RangeWrite to True. You might have hit one of the limitations of the Excel transpose function.
See help file for details.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

18 minutes ago, water said:

Please set parameter ForceFunc of _Excel_RangeWrite to True. You might have hit one of the limitations of the Excel transpose function.
See help file for details.

I felt that was Suppose to change rows to columns and columns to rows.

Thanks The thing worked Charm and data is now getting filled properly.

Thanks once again.

Link to comment
Share on other sites

Also I had One More Query that I have date field in my database.

When Writing to Excel it gets converted into Number.When i Change The formatting to short date i get back the details 

but is there any way to get a workaround not doing all this stuff?

Link to comment
Share on other sites

22 minutes ago, n3wbie said:

I felt that was Suppose to change rows to columns and columns to rows.

That's exactly what the Excel Transpose function does. As this function has its limitations, you can set parameter ForceFunc to True to use the internal Transpose function of the Excel UDF. For this function only AutoIt limits apply and it takes more processing time.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

24 minutes ago, n3wbie said:

When Writing to Excel it gets converted into Number.

That's exactly the way Excel processes date/time values. Plese see: https://www.autoitscript.com/wiki/Excel_UDF#Date_and_Time

 

25 minutes ago, n3wbie said:

When i Change The formatting to short date i get back the details

Formatting changes the way Excel displays it's data. But it does not change the way Excel internally stores data.
You can set the formatting or translate date/time values to a string as described in the wiki.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

2 minutes ago, water said:

That's exactly the way Excel processes date/time values. Plese see: https://www.autoitscript.com/wiki/Excel_UDF#Date_and_Time

 

Formatting changes the way Excel displays it's data. But it does not change the way Excel internally stores data.
You can set the formatting or translate date/time values to a string as described in the wiki.

I Already Know the concept that how it stores.

I was Wondering if there is a way out on how to display as it is.

I tried value and Formula Method in udf Doesnt Seem to change output.

is there any other way doing this.Basic Problem is the data that is retrieved is not known to me so i cant hard code that excel output has to be same.

You can say its like a Connection to unknown database where i cannot map fields.I just want as they look in database or _arraydisplay

Link to comment
Share on other sites

They only way I can think of is to modify the query so it returns all data in the required format.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

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