lib/excel.js
function mergeExcel(src1, src2) {
    if (src1 == undefined) {
        return src2;
    }

    if (src1[0].name != src2[0].name) {
        return src2;
    }

    if (src1[0].data.length <= 2) {
        return src2;
    }

    let dest = [];
    dest.push({name: src2[0].name, data: []});

    for (let ii = 0; ii < src1[0].data.length; ++ii) {
        dest[0].data.push([]);
    }

    for (let ii = 0; ii < src2[0].data[1].length; ++ii) {
        let sf = findField(src1[0].data, src2[0].data[1][ii]);
        if (sf != -1) {
            let cn = src1[0].data.length - 2;

            dest[0].data[0].push(src2[0].data[0][ii]);
            dest[0].data[1].push(src2[0].data[1][ii]);

            for (let jj = 0; jj < cn; ++jj) {
                dest[0].data[jj + 2].push(src1[0].data[jj + 2][sf]);
            }
        }
        else {
            let cn = src1[0].data.length - 2;

            dest[0].data[0].push(src2[0].data[0][ii]);
            dest[0].data[1].push(src2[0].data[1][ii]);

            for (let jj = 0; jj < cn; ++jj) {
                dest[0].data[jj + 2].push('');
            }
        }
    }

    for (let ii = 1; ii < src2.length; ++ii) {
        dest.push(src2[ii]);
    }

    return dest;
}
function mergeExcel(src1, src2) {
    if (src1 == undefined) {
        return src2;
    }

    if (src1[0].name != src2[0].name) {
        return src2;
    }

    if (src1[0].data.length <= 2) {
        return src2;
    }

    let dest = [];
    dest.push({name: src2[0].name, data: []});

    for (let ii = 0; ii < src1[0].data.length; ++ii) {
        dest[0].data.push([]);
    }

    for (let ii = 0; ii < src2[0].data[1].length; ++ii) {
        let sf = findField(src1[0].data, src2[0].data[1][ii]);
        if (sf != -1) {
            let cn = src1[0].data.length - 2;

            dest[0].data[0].push(src2[0].data[0][ii]);
            dest[0].data[1].push(src2[0].data[1][ii]);

            for (let jj = 0; jj < cn; ++jj) {
                dest[0].data[jj + 2].push(src1[0].data[jj + 2][sf]);
            }
        }
        else {
            let cn = src1[0].data.length - 2;

            dest[0].data[0].push(src2[0].data[0][ii]);
            dest[0].data[1].push(src2[0].data[1][ii]);

            for (let jj = 0; jj < cn; ++jj) {
                dest[0].data[jj + 2].push('');
            }
        }
    }

    for (let ii = 1; ii < src2.length; ++ii) {
        dest.push(src2[ii]);
    }

    return dest;
}
src1 是老版本，src2 是新版本