S
S
saygoodluck2021-04-26 16:48:55
HTML
saygoodluck, 2021-04-26 16:48:55

How to transfer data from csv/pdf table to html table?

I have tables with a large amount of data.

6086c29c3c90c410523041.png
I would like to insert some columns from this table into the html code as in the figure below:

6086c0575524e703349915.png
What is the best way to perform such a transfer, or at least simplify the task?

Previously, I wrote Java code to automate this, but due to the fact that from time to time the table headers and contents change, it needs to be constantly changed and this takes a lot of time.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Yuriev, 2021-04-26
@saygoodluck

Forget PDF right away
Since you didn’t really indicate the language of the backend, except that it was once Java (something tells me what JS meant, people who write in Java ask deeper questions), then let’s say you have php
https: //www.php.net/manual/ru/function.fgetcsv.php - for large csv, so as not to load the entire document at once

$file = fopen('myCSVFile.csv', 'r');
while (($line = fgetcsv($file)) !== FALSE) { // смотрите документацию, скорее всего
                                             // разделитель поправить придется

  print_r($line); // $line здесь - представление строки из csv файла как массива
}
fclose($file);

https://www.php.net/manual/en/function.str-getcsv.php - if the array of strings is already in memory (in a variable), but for large files it's
bad manners to you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question