Import several cells from 1 column from 1 table in 1 cell in column in another table

How to write code to import several Cells from 1 Column from 1 Table in 1 Cell in Column in another Table.
I m not a programmist. I need that code to import in one software that has it own language, so i don’t need special code for java or python, i need basic code how to do it, then i will change the code to my software language.
Look picture to understand better what i need.

I understand you aren’t a programmer, but you need to understand that the tool you are using to deal with that data matters a lot here. That is just a picture of some tabular data: is it a spreadsheet? Is it a database? Is that just a nice picture of a data structure? We do not know a. what is on your computer screen and b. what you know or don’t know.

For an example of why this isn’t transferrable without a lot more information, if the two tables were represented as arrays of objects in JS, then here’s some code. But it’s almost guaranteed to not be useful, because the tool is different:

function linearlyImportT1ValuesToT2 (table1, table2) {
  const modelMap = {};

  for (const {type, model} of table1) {
    if (type in modelMap) {
    } else {
      modelMap[type] = [model];
  for (const {type, model} of table2) {
    model = modelMap[type];

But that code is really just gibberish without any context, it only works in one specific situation

1 Like

I m not a programmer, i m a system administrator.
I need to import data from csv file in business-process software in spreadsheet. BPS needs code to import big amount of data.
I painted that picture so people would better understand what i need.
Thanks in advance.

So, the basic ‘code’ or generic Algorithm?

I would set TABLE 2 as the “master” to loop through.

let table1 = TABLE1 //define table1
let table2 = TABLE2 //define table2
let table2Exported  = [] //empty table
let models = [] //empty holder

for (let i = 0; i < table2.length - 1; i++) { //Loop through each ROW in table2
  //assuming i for 0 = [AA,R1]
    let models = table1.filter(j => return j[0] === i[0]).map(k => k[1])
      //filter/search table1 for all matching types
      //models for i[0] = [[AA,F1],[AA,F2],[AA,F3]]
      //map for just the 'model' value
      //models for i[0] = [F1,F2,F3]
      table2Exported.push([...i, models]) //push/add each to build export table
      //table2Exported[0] = [AA,R1,[F1,F2,F3]]

This is assuming a random dataset between the tables. But, you could improve the algorithm if you know they are in order by doing a “TYPE” check if (i[0] = i-1[0]) so you can skip the filter/map step if the TYPEs are in order. Or if you know they are in sets of 3 you could go that route.

1 Like