Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Copy the data out of a Confluence table as CSV using Chrome devtools
function escapeAsCsv(str) {
// Double up double quotes and quote the entire string if necessary
if (str.includes(',') || str.includes('\n') || str.includes('"')) {
return '"' + str.replace(/"/g, '""') + '"';
}
return str;
}
// Export Confluence table as CSV
// Select the tbody element in Chrome devtools Elements panel then run the
// following in the Console to copy the contents of the table as CSV to the
// clipboard.
copy(jQuery('tr', $0).get().map(function (row) {
return jQuery('p', row).get().map(function (elm) {
return escapeAsCsv(elm.textContent);
}).join(',');
}).join('\n'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.