const sheetID = “1hfyBHgPnQ7ENHDK31HAaXzHLT2pqtceMENRUZEUMndk”;
const sheetName = “Sheet1”;
const url = `https://docs.google.com/spreadsheets/d/${sheetID}/gviz/tq?sheet=${sheetName}`;
fetch(url)
.then(res => res.text())
.then(rep => {
const jsonData = JSON.parse(rep.substr(47).slice(0, -2));
const rows = jsonData.table.rows.map(row => row.c[0]?.v || “”);
const chunks = [];
for (let i = 0; i < 5; i++) {
chunks.push(rows.slice(i * 100, (i + 1) * 100).join("\n"));
}
let html = '';
chunks.forEach((chunk, i) => {
html += `
`;
});
document.getElementById(“data-container”).innerHTML = html;
})
.catch(err => {
document.getElementById(“data-container”).innerHTML = “Không load được dữ liệu.”;
console.error(err);
});
function copyText(id) {
const textarea = document.getElementById(id);
navigator.clipboard.writeText(textarea.value);
}