【发布时间】:2019-02-28 13:54:08
【问题描述】:
我正在使用包 xlsx 并尝试在循环中编写一些东西。
如果我直接写单元格号码,例如G3,它可以正常工作,但显然这样的东西不能工作:
const workbook = XLSX.readFile('test.ods');
const sheet_name_list = workbook.SheetNames;
const sheet = workbook.Sheets[workbook.SheetNames[0]];
(...)
let i = `G${k+1}`;
//we got a match , write the scores in the cells
sheet[i] = {t: 's' /* type: string */, v: checkData[k].location_id };
关于如何使用动态值作为单元格名称的任何想法?
【问题讨论】:
-
您好,我需要动态提供值 sheet['G3'] = {t: 's' /* type: string /, v 而不是要写入的静态单元格值: '测试' }; VS sheet[
G${(k+1)}] = {t: 's' / type: string */, v: 'test' };
标签: javascript arrays node.js xlsx