Excel file to php?

I’m currently wrestling with a problem that I have and looking for a solution.

I have a small database setup in Caspio … but their syntax is completely different to Excel and I can’t make head nor tail of it :frowning_face:

So, I’m wondering if there is any way of converting the working Excel sheet to a php web page with the excel functions working (so that I could upload the page to my web site for online input etc) ??? Thanks in advance

What is the problem you’re having? Do you want to make an excel sheet available over the internet for multiple people to edit?

If so you’re much better off using a proper solution for this. I think Microsoft Teams is free for this kind of use. But Google docs, OnlyOffice, etc also allows you to do this.

Greetings,
Many thanks for taking the time and trouble to comment. I’ve looked at MS Teams and it really doesn’t quite do what we need.
I’ve found a few scripts which have some promise. They are file upload scripts, but they all seem to imply that they only handle image files.
Having examined all options what would be ideal would be a file upload script that will handle .html files and upload them into a directory where it will over-right an existing file of the same name.
Trouble is, I’ve spent days looking through the internet but so far have not been able to find a suitable script.
Thanks again for your interest

If you write up what you’re actually trying to do then it would be a lot easier helping.

first post you ask for a way to convert an excel sheet to a web page with excel functions for online input. in this second post you are simply after an upload script for html files…?

Yes, I have changed tack as apart from this community help is quite scarce apart from obvious sarcastic comments from those who have better knowledge than I, and who should know better, so I’ve been searching under my own steam for a solution. The initial line of thought about converting Excel sheets to web pages turned out to be a no go as it didn’t return the sort of results I was looking for and I was advised that a php solution might be a better way of doing what was needed.
Converting Excel sheets to an html page doesn’t retain much of the functionality that is needed, so I looked at php for a solution.
As a relative novice to php I have been looking for a script to upload a file and over write the existing one. However, all I can seem to find are scripts that upload image files (everyone seems to think that image files are the only fiie types that anyone might ever want to upload) and I certainly haven’t been able to find anything, code wise, that will over-write an existing file.

Thanks anyway for your interest…

This should do the trick
https://www.tutorialspoint.com/php/php_file_uploading.htm

Note that even though it says $_FILES[‘image’] it’s not strictly for image upload, it’s simply the name they’ve chosen for the input field in the form below. If you change both those to “jimisawesome” it will still work.

It then has a check for file extension, in theory you don’t even need this but it’s always good to check that you receive what you expect, just change it to the extensions you do accept.

It then checks for a specific file size, which definitely is just to show further how to add constraints to what is acceptable to upload. You definitely don’t need this one.

If you then check the definition for move_uploaded_file you will see that it actually overwrites any existing file - as you want

Warning If the destination file already exists, it will be overwritten.
https://www.php.net/manual/en/function.move-uploaded-file.php

Things like this can be a big frustration for new coders as it’s very easy to look for a write up or tutorial on the exact issue one is working on. But when you get past that and see you can adapt things you find online to suit your use case there is an ocean of information and help out there.


The reason I’m again asking what your actual problem is - is

The XY problem is a communication problem encountered in help desk and similar situations in which the real issue, X , of the person asking for help is obscured, because instead of asking directly about issue X , they ask how to solve a secondary issue, Y , which they believe will allow them to resolve issue X . However, resolving issue Y often does not resolve issue X , or is a poor way to resolve it, and the obscuring of the real issue and the introduction of the potentially strange secondary issue can lead to the person trying to help having unnecessary difficulties in communication and offering poor solutions.
https://en.wikipedia.org/wiki/XY_problem

Since a lot of the people answering technical questions online online, be it forums, facebook or stack overflow, have some experience with these things it’s fair to question if the solution you’re trying to code is actually the best one.

I’m still not sure what you’re actually trying to achieve, but I am sure me and others here would like to pitch in on potential solutions if you take another go at explaining what this excel / html stuff you want to do is all about.

Many thanks. That looks exactly like what I’ve been looking for.
OK, let me try and explain the problem.
We have an Excel sheet that automatically sorts a series of golf scores into a leaderboard. It works perfectly using the ‘=LARGE($C4:$N4,1)’ syntax to establish the position on the leaderboard. However, none of the Excel conversion to html solutions work in as much as they don’t transfer the interactivity … and the Caspio online database we use does not support the excel functionality so the leaderboard file will not function.
Therefore, it was proposed to continue to use the master leaderboard Excel sheet and then use the ‘Save as …’, Web page … function to generate a web page representation of the excel sheet.
Now, none of the committee are anywhere near techniacally capable when it comes to web site operations so I am looking to make this process as idiot proof as possible; therefore if I can get this script to work they can manipulate/update the excel sheet and do the save as function ok, then using a web page on the society’s site, they can then upload the resulting page showing the sheet without any need to start using ftp clients etc.
Most of the Excel conversion programs/sites are extremely expensive and it seems like they don’t produce anywhere near the results that we are looking for as I’ve run several ‘trials’ on different systems … all of which are incapable of transferring the functionality.
I trust that this brief explanation has maybe cleared the waters slightly LOL
Again, many thanks for your interest and response.

Does the golf scores come from Caspio? If so it seems like you could use their Swagger UI to get (and add) data. If this is the same online db you’re using I’d suggest just ditching excel and making a website where you can add records / view the leaderboard by querying the database directly.

Not sure how dependant you are on caspio but I’m quite sure a simple php/db setup would be easier to get your head around than integrating a 3rd party “online db” solution.

Greetings, Thanks for the input … however, as the society is non-profit making and has only about 100 ± active mebers, therefore the Caspio account is the ‘free’ version with limited functionality.
In addition, most of the committee are still using pencil and paper, let alone cell phones (if you get my drift) and I’m fighting tooth and nail to drag the whole thing into the 20th let alone the 21st century LOL
Using Excel is just about on the limit of their cutting edge and they are insisting on using the Excel approach and are extremely reluctant to move anywhere near any sort of cloud solution LOL. It took me a while to convince them about the usefulness of Caspio, even in it’s form … so for now, I guess it’ll have to be Excel as the paid version of Caspio, even in it’s most basic paid for version is beyond the funding capability of the society :frowning:Thanks again for the assistance.

I assume someone (you?) still take their score cards and enter it into the caspio db anyway?

I would probably look into making a website for this anyway. I’d also look into parsing excel files so they can still hand in their score cards in excel and you can just upload them and let the website handle the data entry.

If caspio is limiting your possibilities then I’d just change to a php/mysql solution, you can have one up and running for very little money in no time

Thank you. That is all very logical but totally allien to the mind set of the Committee and the way they want things doing.
I’ve been banging my head against a brick wall for 12 months now and I think I’m going to find a high building and throw myself off it … symbolically speakimg. Once I’ve got this sorted, then I’m having nothing more to do with it … the more you do (for nothing) the more they want but in their own way … which is totally at odds with the technology. Thanks again

Sorry, forgot to mention that the scores are entered manually because theyhave to be submitted to the SPanish Golf Federation and even if we could, the api for caspio will not display the data as per the desires of the committee … it’s a bit like a gentlemans club in the 18th century really. I give up on them !!! Thanks anyway

Ok, hope you will have more freedom to make a proper/modern solution with your next project :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service