It is possible to export Chrome bookmarks to a html file with the name bookmarks_dd-mm-yyyy.html:
- select the three vertical points at the top right
- select bookmarks
- select bookmark manager
- select the three vertical points at the top right
- select export bookmarks
The Chrome bookmarks can be imported somewhere else via the html file.
I do want to share bookmarks but not all of them. Only bookmarks stored in some specific bookmark folders. That is possible [what not ;-)] with Google Apps Script.
Bookmark folder names need to be unique.
It took some time before I understood that 'new lines' [\n] had to be added.
function bookmarx2Share(){ var bookmarkFolders = [["parentFolder_1","childFolder_11","childFolder_12","childFolder_13"],["parentFolder_2","childFolder_21","childFolder_22","childFolder_23"]]; var html = ""; html += '<!DOCTYPE NETSCAPE-Bookmark-file-1>\n'; html += '<!-- This is an automatically generated file.\n'; html += 'It will be read and overwritten.\n'; html += 'DO NOT EDIT! -->\n'; html += '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">\n'; html += '<TITLE>Bookmarks</TITLE>\n'; html += '<H1>Bookmarks</H1>\n'; html += '<DL><p>\n'; for (var b=0;b< bookmarkFolders.length;b++){ var bookmarkFolder = bookmarkFolders[b]; html += '<DT><H3 ADD_DATE="" LAST_MODIFIED=">' + bookmarkFolder[0] + '</H3>\n'; html += '<DL><p>\n' for (var c=1;c< bookmarkFolder.length;c++){ var bookmarkSubFolder = bookmarkFolder[c]; if(bookmarkSubFolder !== ""){ var bookmarxPerSubFolder = bookmarxPerFolder_(bookmarkSubFolder); html += '<DT><H3 ADD_DATE="" LAST_MODIFIED=">' + bookmarkSubFolder + '</H3>\n'; html += '<DL><p>\n'; for(var d=0;d<bookmarxPerSubFolder.length;d++){ var bookmark = bookmarxPerSubFolder[d]; html += '<DT><A HREF="' + bookmark[1] + '" ADD_DATE="" ICON="">' + bookmark[0] + '</A>\n'; } html += '</DL><p>\n'; } } html += '</DL><p>\n'; } html += '</DL><p>\n'; var bookmarxFile = DriveApp.createFile('Bookmarx',html,"text/html"); var emails = ContactsApp.getContactGroup("BOOKMARK_CONTACTS").getContacts().map(function(contact){return contact.getEmails()[0].getAddress()}); GmailApp.sendEmail(emails,"Bookmarx shared with you","",{attachments: [bookmarxFile.getAs(MimeType.HTML)]}) } function bookmarxPerFolder_(folder) { var html = "bookmarks_dd-mm-yyyy.html"; var folderPlus = ">" + folder + "<"; var bookmarxArray =[]; var files = DriveApp.getFilesByName(html); while(files.hasNext()){ var file = files.next(); var bookmarx = file.getBlob().getDataAsString().split(folderPlus)[1].split("</DL><p>")[0].split(/<DT><A HREF="/); for(var b=1;b<bookmarx.length;b++){ var bookmark = bookmarx[b]; var textBookmark = bookmark.split(/<\/A>/)[0].split(/">/)[1].trim(); var urlBookmark = bookmark.split(/"/)[0].trim(); bookmarxArray.push([textBookmark,urlBookmark]) } } return bookmarxArray.sort() }