Skip to content

Commit 5e68c8b

Browse files
committed
Add excel export
1 parent 2ff419b commit 5e68c8b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,16 +304,24 @@
304304
let m = circles.length;
305305
let n = (m > 0) ? circles[0].length : 0;
306306
let result = "[\n";
307+
let excelResult = ""
307308
for (let i = 0; i < m; i++) {
308309
result += " [";
309310
for (let j = 0; j < n; j++) {
310311
let x = circles[i][j].x;
311312
let y = circles[i][j].y;
312313
let gray = getMeanGrayAt(x, y, radius);
313314
result += `${gray}${j < n - 1 ? ", " : ""}`;
315+
excelResult += `${gray}${j < n - 1 ? "\t" : ""}`;
314316
}
315317
result += `]${i < m - 1 ? ",\n" : ""}`;
318+
excelResult += `${i < m - 1 ? "\n" : ""}`;
316319
}
320+
navigator.clipboard.writeText(excelResult).then(() => {
321+
alert('Table copied to clipboard! Paste into Excel.');
322+
}).catch(err => {
323+
console.error('Failed to copy:', err);
324+
});
317325
result += "\n]";
318326
document.getElementById("grayOutput").value = result;
319327
}

0 commit comments

Comments
 (0)