Create/Update Excel Workbook

Started by Tom Anderson, June 06, 2023, 02:12:47 PM

Previous topic - Next topic

Tom Anderson

Also,

I tried the program on customer's system today and got the same results (v16)

James Zukowski

Tom:
Try printing HTA(x_obj'sep$) to see what's actually there.
Also, what server/client operating systems are you running? WindX? nthost/ntslave? Simple CS? These might help point to the problem.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Tom Anderson

James,

hta(x_obj'sep$) = 8A

Windows Server 2019. Using Windx running on Windows 7, 10 and 11. Tried them all. Same result. Latest Excel version and also tried Excel 2016.


Tom Anderson

Update - downloaded and installed demo version of version 20 and the program now works as expected.

I am wondering if I have the latest version of 16 installed. When I look on the website it shows 16.2 in the downloads section.

How can I determine exactly what version I have installed?

Thanks!


James Zukowski

From command mode, print SSN
The first 4 digits are the version number; 2 digits major, 2 digits minor
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Susan Cryderman

Tom,

You can print TCB(29) to see what version is installed.  Version 16 should show 16000000 and 16.2 should show 16200000.

Just to clarify - were you still using WindX when it worked using verison 20?

Thanks,

Susan Cryderman

Tom,

It appears that writing the data using WindX may be the issue.  Please open a support ticket and be sure to provide the version and serial number.


Tom Anderson

Susan,

I was not using Windx with version 20.

I checked and have version 1600 installed.

I will open a support ticket per your suggestion.

Tom

Tom Anderson

Issue finally resolved on creating Excel spreadsheet.

One other question - my customer uses a number of thin clients in the plant for production entry. All these clients have installed is the Windx client to run the PXPlus software.

It appears you cannot create an Excel spreadsheet from any of these machines do to the fact that Excel is not installed on them.

Is there a way to create and update a spreadsheet without having Excel installed?

Thanks!

Tom

Susan Cryderman

Tom,

The PxPlus Excel object will look for Excel locally on the machine that instantiates the object (X_OBJ=new(*obj/excel).  If you run the program on a workstation, that workstation will need to have Excel installed.  If the program is run on the server - only the server should need to have Excel installed.  However, the excel file created would also be on the server.

There may be ways around this if you do not use the PxPlus Excel Object.

Devon Austen

If you want to create a Excel spreadsheet without Excel you can use Google Sheets via a Google Sheets object to create the spreadsheet and export it as an .xlsx file.

The constructor requires a Client ID and Client Secret, both of which must be obtained from Google via the Google API Console. See Google API App Setup for detailed steps.

Example:


x=NEW("*obj/GoogleSheets",clientID$,clientSecret$)
!
! Wait for user to complete Google sign-in and allow PxPlus access
INPUT "Press any key to continue after logging into Google account and allowing PxPlus access:",*;PRINT ""
!
! Complete the Google Sheets login
x'Login()
!
! Open spreadsheet
path$="Commissions/JuneCommissions"
if x'CreateSpreadsheet(path$)=0 then MSGBOX "Couldn't find "+path$
!
...
! add things to the spreadhseet
...
!
! Export current spreadsheet as a XLSX
if x'ExportSpreadsheet("C:\Users\User\Documents\JuneCommissions.xlsx")=0 then MSGBOX "Couldn't export to xlsx"
!
! Close spreadsheets
if x'CloseSpreadsheets()=0 then MSGBOX "Couldn't close spreadsheets"
!
! Drop object
DROP OBJECT x
END
Principal Software Engineer for PVX Plus Technologies LTD.

Tom Anderson

Devon,

Thanks for the suggestion. I'll look into it.

Off topic...there used to be a keystroke from a command prompt that would display all the current variable values on the screen.

For the life of me, I cannot remember what it was.

Can you help jog my memory.

Thanks!

Tom

James Zukowski

#27
That would be "LV" - as in <L>ist <V>ariables - to list the variable names.
Use DUMP to display their contents, or SD (<S>earch <D>ump) for more specific info. See the manual for details.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services