Page 1 of 1

Reading XLS created with Google Sheets

Posted: Wed Feb 16, 2022 9:28 am
by Brian Cheyne
I have clients that use Google Sheets and then save the file as and XLSX. When I try to read it I get the following error :

ExceptionMessage="Can not find workbook in OPC"

I use Delphi RAD Studio 11 with XLSReadWrite version 6.01.10

Re: Reading XLS created with Google Sheets

Posted: Wed Feb 16, 2022 4:06 pm
by larsa
Hello

Try:

Code: Select all

XLS.UseAlternateZip := True;

Re: Reading XLS created with Google Sheets

Posted: Thu Feb 17, 2022 1:14 pm
by Brian Cheyne
Thank you Lars. I can now read the Sheet.

I have an import function that reads all sizes of Excel files and I rely on the functions FirstCol, LastCol and LastRow to find out how much data I have. These all return -1. If I interrogate Cell[0,0] the value is there, but all those functions return -1.

Re: Reading XLS created with Google Sheets

Posted: Thu Feb 17, 2022 2:42 pm
by larsa
Hello

Use this before reading First/Last:

Code: Select all

XLS[Sheet].CalcDimensions;