Jump to content

Too many "lines" for Excel? Transpose error on a spreadsheet


Recommended Posts

Hello everyone :),

I have spotted a weird problem with the Excel COM API. It doesn't read a spreadsheet with a good amount of lines in a cell... Enough talk, let's get into code:

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

Global $oExcel = _Excel_Open(False, False, False, False, True)
Global Const $sSpreadsheet = @ScriptDir & '\Test.xlsx'
Global $oSpreadsheet = _Excel_BookOpen($oExcel, $sSpreadsheet, True, False)
Global $aSpreadsheet = _Excel_RangeRead($oSpreadsheet)
If @error Then MsgBox(0, "Error", 'Error Code: ' & @error & @CRLF & 'Extended Code: ' & @extended)
_Excel_Close($oExcel, False)

_ArrayDisplay($aSpreadsheet)

(Download Test.xlsx)

I get this error when I run the script:

Ewdmawg.png

If you open the spreadsheet, you can see that I have dummy text in the B2 cell. If you replace the contents of the cell B2 with something like Test4, it will work perfectly fine:

3D099FA.png

 

Is this some kind of undocumented line limit for Excel? :ermm:

Thanks in Advance! TD :thumbsup:

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

this, from the rangeread helpfile?

Quote
$bForceFunc [optional] True forces to use the _ArrayTranspose function instead of the Excel transpose method (default = False).
    See the Remarks section for details.

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Wow, I didn't notice it at all! :blink:.

Thank you very much! :D

P.S I am still interested in why Excel wasn't able to transpose it by itself

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Maybe you hit this limitation?

Quote

The Excel transpose method doesn't support cells with more than 255 characters.

 

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

:)

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

×
×
  • Create New...