Answer the question
In order to leave comments, you need to log in
Transferring INFO from Excel to Mysql?
Good day. Question
1. There are 1000 photos in the https://my.site/photo folder with the title in order (photo1.jpg, photo2.jpg, etc.)
2. There is an Excel file desc.excel with 1000 descriptions for these photos. It has 2 columns: N and DESC. The number goes in order (1,2,3, etc.)
3. There is a Mysql table "photodesc" with columns "ID", "PHOTO", "DESCRIPTION"
I need the result in mysql
ID | PHOTO | DESCRIPTION
1 | https://my.site/photo/photo1.jpg | description from 1 line column "desc"
2 | https://my.site/photo/photo2.jpg | description with 2 lines of column "desc"
https://my.site/photo/photo3.jpg | description with 3 lines of column "desc"
Well, etc. (I can’t insert a table here for some reason, but I think it’s clear)
How can this be implemented? What ideas? Maybe there are solutions through other programs. Help good people.
Answer the question
In order to leave comments, you need to log in
These options have already been proposed, but they can be combined into one.
In Excel, we get the necessary URLs using formulas.
Using formulas, we write a request to add a record to the database.
We copy the received queries from the SQL_Insert field and execute queries to the database. In my case, communication with the database occurs through Navicat.
Result
Another option. Connect to the database using Management Studio.
Select the desired table - right-click - select Edit first 200 rows
Next, select the desired cells in Excel using Ctrl-C and paste them into the database Ctrl-V.
It is important that the order of the columns in Excel matches the order of the displayed columns in the database.
With these manipulations for the first time, it is better to try to insert one record to make sure that the data format in Excel matches the data type in the table fields.
How would I do:
1) add a field with a URL to the excel table
2) excel supports formulas like string + value from another field + string, which easily gives us a normal url to images.
3) Export to csv
4) import to muscle
profit
What is the problem?
We take any PL, we are looking for a library that can read your xls file in the format you need.
Further it is easier - through the same AP we connect to the database and fire queries into the tables.
That's it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question