https://docs.google.com/spreadsheets/d/16L48iNAFn1LRQNakLK47bdPgf1SX3bF4w9Q6ON6AQy8/edit?usp=sharing
这里是我需要做的链接。不确定是否可以通过公式或脚本来实现。
答案 0 :(得分:0)
我认为通过javascript实现此目标最简单的方法是:
这是实现该目标的示例JS代码。
const fs = require("fs");
const file = fs.readFileSync("./Test page - Sheet1.csv", { encoding: "utf-8" });
let rows = file.split("\n");
let last = rows.pop();
let newRows = last
// split by column by comma
.split(/,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/)[7]
// remove the "
.replace(/^"(.+?)"$/, "$1")
// split the data by comma
.split(",")
// mapped the items into rows
.map(item => {
let newRow = Array.from(last.split(/,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/));
newRow[7] = item.trim();
return newRow.join(", ");
});
// save back the data into the file
fs.writeFileSync("./Test page - Sheet1.csv", rows.concat(newRows).join("\n"));