N
N
nedland2021-09-03 15:32:04
MySQL
nedland, 2021-09-03 15:32:04

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

3 answer(s)
P
Planet_93, 2021-09-04
@nedland

These options have already been proposed, but they can be combined into one.
In Excel, we get the necessary URLs using formulas.
6132a616870ec692221238.png
Using formulas, we write a request to add a record to the database.
6132a64d5cf97010474942.png
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.
6132a68deb764896653820.png
Result
6132a6a7b63db821073317.png
Another option. Connect to the database using Management Studio.
Select the desired table - right-click - select Edit first 200 rows
6132a82dc4d23510282007.png
Next, select the desired cells in Excel using Ctrl-C and paste them into the database Ctrl-V.
6132a989e935c927888352.png
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.

T
ThunderCat, 2021-09-03
@ThunderCat

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

V
Vladislav Orlov, 2021-09-03
@haveacess

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 question

Ask a Question

731 491 924 answers to any question