I have some questions about how to import an Excel to phpmyadming:
1.- As I have read, once I have the Excel created I have to saves it as .csv, but the problem I find is that in this type of field the columns are separated with commas, and I find it a problem because one columns is a descripción (a large text) which has commas…is there any way to skip this problem?
2.- The Excel is created with an scraping method, but I have to add at least two columns to the Excel. I know that I can do it manually but…it’s an Excel that will be updating everyday, do I have to introduce the data manually everyday? at this point I find also another problem, now I have almost 3.000 rows, and if more games are added to the webpage I am scrapping, the amount of rows will be different, and the new game or games will be added anywhere. I don’t know how to deal with this problem.
3.- Once the first Excel created, I would like to revise if there are changes in the prices, and if there are, update the Excel cell and mark it with a green color (for example). Is there any way to do this?
Thanks in advice,
Have a good day.
I have used this tool to read Excel files and get the data in PHP. Maybe that will be better for you than CSVs.
Does the Excel file exist for any other reason than for a stepping-stone into MySQL via phpmyadmin? I wonder if it might be easier for you to modify the scraping code to submit the data directly into an sql database rather than going via Excel.
On point 2, does the scraping create a new blank worksheet each time? If it simply updates an existing sheet, perhaps it can be modified to leave your additional two columns in place. I am not familiar with programmatically modifying Excel. Same goes for point three - that’s really an Excel thing rather than a PHP language thing. You’d need to modify the scraping code to check the existing value and set the text or background colour if the price has changed. I would imagine though if the scraping code can do this, then it could leave your additional two columns in place as well.
On the first point, is there an option in the “Save As” to separate the data with tabs or pipe (|) characters instead? I know Excel will handle different delimiters when it imports data, for precisely this reason.
If you have a field in a CSV file that contains commas, then the whole field should be surrounded by double-quote marks. If you save an Excel spreadsheet as a CSV file it will do this for you automatically.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.