Interfacing PHP with an Excel spreadsheet / VBA Script - php

I have a client that has developed an Excel spreadsheet to calculate various statistics using VBA Script (Excel/VBA is not my forte to say the least). He wants me to create a web front-end for this (I will be using PHP / CakePHP) that will have a simple form for inputting cell values, will query the spreadsheet and return the values for display on the website.
The client does not want to convert the Excel/VBA script to another language - he wants to keep it in a 'silo' and just have the website query the existing script.
Is this possible? Any libraries that can help? How could I go about this?

You'd need to run MS Excel itself, and use COM... it's the only method of which I'm aware that would allow you to run VBAScript within the Excel workbook from your PHP. You couldn't even use OpenOffice for this, so it limits you to a Windows Server with MS Excel installed

Related

How to import csv to firebase using PHP? [duplicate]

I see we can import json files into firebase.
What I would like to know is if there is a way to import CSV files (I have files that could have about 50K or even more records with about 10 columns).
Does it even make sense to have such files in firebase ?
I can't answer if it make sense to have such files in Firebase, you should answer that.
I also had to upload CSV files to Firebase and I finally transformed my CSV into JSON and used firebase-import to add my Json into Firebase.
there's a lot of CSV to JSON converters (even online ones). You can pick the one you like the most (I personnaly used node-csvtojson).
I've uploaded many files (tab separated files) (40MB each) into firebase.
Here are the steps:
I wrote a Java code to translate TSV into JSON files.
I used firebase-import to upload them. To install just type in cmd:
npm install firebase-import
One trick I used on top of all the one already mentioned is to synchronize a google spreadsheet with firebase.
You create a script that upload directly to firebase db base on row / columns. It worked quite well and can be more visual for fine tuning the raw data compared to csv/json format directly.
Ref: https://www.sohamkamani.com/blog/2017/03/09/sync-data-between-google-sheets-and-firebase/
Here is the fastest way to Import your CSV to Firestore:
Create an account in Jet Admin
Connect Firebase as a DataSource
Import CSV to Firestore
Ref:
https://blog.jetadmin.io/how-to-import-csv-to-firestore-database-without-code/

How to upload spreadsheet with script and enable triggers remotely?

I'd like to be able to upload a new spreadsheet to my drive remotely from my server as needed (using Google's PHP Drive API, say), and it to trigger to run once daily at a given time, then read that spreadsheet remotely once a day after the script runs. I want to fully automate this. I don't want to have to manually install the sheet and set up the trigger for each.
The guides, API, tutorials I've found have not been very clear about how to specifically upload a spreadsheet with an associated script and set triggers. Is this possible? And how do I go about it? If there are some good resources I've missed, much appreciate pointing me to them.
Thanks.
There is no way yo "upload" a Google spreadsheet from a local server since they are online documents. You could use a template that has an embedded script but the script would require authorization to run so it won't fit your requirement neither.
Why don't you use a standalone script (or an embedded script in a "master sheet") that would do what you need to do in all the spreadsheets you create (or even upload/convert from ods or excel files with data) ?
One single script can access any number of spreadsheets and do about everything an embedded script can do in these sheets while requiring only one single authorization. This script could create the files and work on a daily timer to do the job.

Reading a button on Excel using PHP

I'm working with the site which is required to read the excel file cell data using PHP. And I'm successfully made it using the PHP EXCEL. As the progress moved, My client require me to read the button on the excel file which is an excel macro button. So he can able to trigger it, using the site, without signing in to the server.
Is this possible? Is there anyone can give me an idea regarding this task?
Form data (such as buttons) and macros are not supported by PHPExcel.
To access buttons and execute macros, you'd need a solution based on MS Excel itself (I don't believe Open/Libre Office supports MS Excel macros or VBA Script) which limits you to COM and a Windows platform

Read online data into Excel - from PHP server?

I want to connect Excel to my web site, as an external data source, and thereby run reports on the data that is fetched from my website. I have heard that this should be possible to do and Excel seems to support it, but I have little knowledge on how I actually should build the backend on my PHP server to serve the data. How do I do it?
I am well aware of the fact of being able to create and read Excel files on a PHP server, but that's not what I am after.
Excel supports IQY, internet queries.
You may define one in excel pointing at your webserver and get the data right into excel.
You may use formatted html-tables at your server. Colors will be preserved.
the iry-format is described at:
http://support.microsoft.com/kb/157482
and supports both post/get and parameters.
regards
//t

Crystal reports, mysql using a php website, Is it possible?

I have been asked to find out if it is possible to connect Cyrstal Reports to a MYSQL database within a php website.
Is this possible?
Are their any alternatives
Thanks
Edit I suppose in the perfect world I am wanting to show crystal reports within a PHP website
As an alternative you can use iReport. You can use it just as you need, with a mysql database from a php website.
In response to your comment:
I would want to show CR within the PHP website
CR being a Windows executable, this will not be directly possible (aside from embedding a Remote Desktop or VNC instance, but this is probably not feasible, and would not be legal.)
Your best bet is to check whether CR has an export format that can be embedded into the web site: PDF, HTML, XML come to mind. Those you could insert into your web page manually.
If you want automated interaction between the web site's user and CR, this probably possible, but not going to be trivial. There are third party products that allow controlling CR from the command line. You may be possible to set up an interaction between PHP and Crystal Reports through the command line on a Windows server, but it's going to be a lot of work.
Your question isn't very clear, if you're trying to ask if you can connect Crystal Reports to a MySQL database (a MySQL database that is connected to a PHP site) then you might be able to, have a look at this article.
If you're tying to connection Crystal Reports to a MySQL database and embed it within a PHP application... well I'm not too sure, perhaps someone else can tackle this problem.
http://www.eakes.org/80/connecting-to-mysql-with-crystal-reports-xi/
Using Crystal Reports to generate reports from a mySQL data base works fine. Install the latest and greatest mySQL ODBC driver and just do it.
If you want to serve up pre-generated Crystal report .rpt files via a PHP-based web site, that is straightforward. You can ask your users to download the Crystal Report Viewer, and just send out those files as if they were, say, .doc or .xls files.
The viewer is here.
The tricky bit is generating Crystal files on demand. You'll need to control the Crystal instance based on input from your web site users. You'll need to ask them to wait while Crystal runs. SAP sells a server edition of their product for this purpose that works well, but it costs money.
Groff Automation makes a product called Crystal Delivery. It works well for running routine reports.

Categories