40

I have created some search entries in Google Chrome using 'Edit search engines'.

How can I share some of these entries with my colleagues?

  • This is such a great question. I found ludovic.chabant.com/devblog/2010/12/29/… but don't want to bother trying it since it's from 2010-2011. 5 to 6 years on the internet is an eternity. I wish there were a convenient (updated) way to share across Google accounts and across profiles within the same Chrome installation. – Ryan Jul 12 '16 at 16:03
  • Can someone create a feature request to Google so we all can upvote it there? – userJT Feb 3 at 17:31
17

Here is a simple solution to export and import Chrome search engine settings without using any external tools or editing the registry:

  1. Open the Search Engine Settings page in Chrome (chrome://settings/searchEngines).
  2. Open Chrome Developer Tools.
    • Shortcut: F12 or Ctrl+Shift+I (on Windows, shortcuts on other platforms may differ).
    • Manual navigation: Three-dot menu in upper-right corner > More Tools > Developer Tools.
  3. Click Console in the top menu bar of Chrome Developer Tools.
  4. Paste one of the following scripts into the console and press Enter.

To download a JSON file with search engine settings:

(function exportSEs() {
  /* Auxiliary function to download a file with the exported data */
  function downloadData(filename, data) {
    const file = new File([data], { type: 'text/json' });
    const elem = document.createElement('a');
    elem.href = URL.createObjectURL(file);
    elem.download = filename;
    elem.click();
  }

  /* Actual search engine export magic */
  settings.SearchEnginesBrowserProxyImpl.prototype.getSearchEnginesList()
    .then((searchEngines) => {
      downloadData('search_engines.json', JSON.stringify(searchEngines.others));
    });
}());

To import settings from a JSON file created using the script above:

(async function importSEs() {
  /* Auxiliary function to open a file selection dialog */
  function selectFileToRead() {
    return new Promise((resolve) => {
      const input = document.createElement('input');
      input.setAttribute('type', 'file');
      input.addEventListener('change', (e) => {
        resolve(e.target.files[0]);
      }, false);
      input.click();
    });
  }

  /* Auxiliary function to read data from a file */
  function readFile(file) {
    return new Promise((resolve) => {
      const reader = new FileReader();
      reader.addEventListener('load', (e) => {
        resolve(e.target.result);
      });
      reader.readAsText(file);
    });
  }

  const file = await selectFileToRead();
  const content = await readFile(file);
  const searchEngines = JSON.parse(content);
  searchEngines.forEach(({ name, keyword, url }) => {
    /* Actual search engine import magic */
    chrome.send('searchEngineEditStarted', [-1]);
    chrome.send('searchEngineEditCompleted', [name, keyword, url]);
  });
}());

Notes

  • I tested the scripts in Chrome 75.0.3770.100 on Windows 8.1.
  • The scripts export and import search enines in the Other Search Engines section only but they can easily be tweaked to include default search engines as well.
  • Do not try to distribute the scripts as bookmarklets, bookmarklets do not execute on chrome:// URLs (been there, done that).
  • These instructions worked perfectly well for me, chrome version 74. – Jason Aug 5 '19 at 13:52
  • Brilliant, still works on v78 windows. – junvar Nov 26 '19 at 21:25
  • 1
    I used this to transfer my Chrome search engine settings to Chromium Edge! Brilliant. – Scott Rhee Jan 8 at 23:23
  • Clipboard copy variant: settings.SearchEnginesBrowserProxyImpl.prototype.getSearchEnginesList() .then((searchEngines) => { /* in one line */ result = JSON.stringify(searchEngines.others); /* with linebreaks and indentation */ result = searchEngines.others; }); copy(result); (I added and activated an option to leave the linebreaks and indentation.) Paste just this into the console (<Ctrl>+<Shift>+<J>). – Aaron Thoma Feb 8 at 21:20
7

Here's a single command to export your chrome search engines as CSV on linux:

sqlite3 -csv ~/.config/chromium/Default/Web\ Data 'select short_name,keyword,url from keywords' > ~/search-engines.csv

You need sqlite3 installed. Replace ~/.config/chrome with the corresponding Windows path if you're on Windows. Should be something like %AppData%\Local\Google\Chrome\User Data

Exporting as SQL for re-importing elsewhere

Instead of exporting to CSV, you could export to sqlite insert statements:

(printf 'begin transaction;\n'; sqlite3 ~/.config/chromium/Default/Web\ Data 'select short_name,keyword,url,favicon_url from keywords' | awk -F\| '{ printf "insert into keywords (short_name, keyword, url, favicon_url) values ('"'"%s"'"', '"'"%s"'"', '"'"%s"'"', '"'"%s"'"');\n", $1, $2, $3, $4 }'; printf 'end transaction;\n') > ~/search-engine-export.sql

Then copy ~/search-engine-export.sql to the other machine, and import with this command:

sqlite3 ~/.config/chromium/Default/Web\ Data < search-engine-export.sql

Making sure to replace the Web Data path with the one on your machine as described above.

  • Worked great for me! And I'd like to give a plug for WSL on Windows 10, which essentially makes this a Windows-native solution. Would you also share the command to import? – tbc0 Sep 12 '18 at 19:11
  • 1
    @tbc0 I've added import instructions as well. I haven't tested on WSL but it should work in theory... – William Casarin Sep 13 '18 at 19:41
  • You may have to handle the ' character. You can add this in your awk function esc(s){gsub("\x27","\x27\x27",s);return s} for $1 and $2 ====> esc($1), esc($2) – Yzmir Ramirez Mar 3 '19 at 6:31
4

It's possible, but it's enough of a pain that you won't want to.

  1. Find the Web Data file in your Chrome profile. In Windows 7 it will be here: "%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\Web Data"

  2. Open the file with an SQLite program like SQLite Studio or sqlite in Ubuntu (sudo apt-get install sqlite) and export the keywords table in SQLite Studio or run this command in Linux: sqlite3 "Web Data" ".dump keywords" > keywords.sql SQLite Studio export dialog

  3. Have your colleagues import the keywords, doing the reverse of this process.

Like I said, possible, but painful.

I wrote a Javascript parser to convert the SQL from Web Data into the nearly universal Netscape Bookmark File Format in HTML (ironic that the definitive standard for that format seems to be Microsoft) if you're interested in getting the keywords into other browsers like Firefox or Opera.

If you're interested in an alternative solution, I created Shortmarks to allow you to use the same set of custom search engines in any browser, and I plan to implement the ability to share with others soon. The upcoming release in a few days will have the import code I mentioned above as soon as I'm finished testing the new features.

  • 1
    Although I wish Google made it easier, I didn't personally feel "it's enough of a pain that I won't want to try". Patrick's answer was very helpful for me: superuser.com/a/688270/74576 – Ryan May 21 '17 at 16:22
  • William's answer superuser.com/a/1350144/92959 was totally easy. I found Patrick's answer to be very complex compared with William's. – tbc0 Sep 12 '18 at 19:15
2

I did following to share my Google Chrome search engine entries and it worked perfectly fine for me:

  1. WINDOWS XP: Go to C:\Documents and Settings\MyUserName\Local Settings\Application Data\Google\Chrome\User Data\Default

    ON WINDOWS 7: Go to C:\Users\MyUserName\AppData\Local\Google\Chrome\User Data\Default

  2. Copy these 3 files: Preferences, Web Data and Web Data-journal

  3. Put those 3 files onto the target machine

  • worked for me without "web data-jounal" (just drop both file into the "default" folder, restart chrome) – JinSnow Nov 11 '15 at 5:48
1

For me, I'm on Windows 10 and I wanted to copy search engines from my personal chrome profile to my corporate chrome profile. I did the following:

  1. I downloaded SQLite from https://www.sqlite.org/download.html (under "Precompiled Binaries" with the description "A bundle of command-line tools for managing SQLite database files"). I unziped it to c:\utils that's already in my path

  2. I opened up cmd.exe

  3. I changed directory to my default (personal) chrome profile

    cd "%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default"

  4. I exited Chrome entirely (even in the tray). Also, keep a copy of these instructions (or open them in a different browser) because you'll loose them.

  5. I ran the following:

    sqlite3 "Web Data" ".dump keywords" > c:\keywords.sql

  6. I changed to the new profile:

    cd "..\Profile 2\"

  7. I ran this:

    sqlite3.exe "Web Data" < c:\keywords.sql

    I got the following errors, which are okay:

Error: near line 4: UNIQUE constraint failed: keywords.id Error: near line 5: UNIQUE constraint failed: keywords.id Error: near line 6: UNIQUE constraint failed: keywords.id Error: near line 7: UNIQUE constraint failed: keywords.id Error: near line 8: UNIQUE constraint failed: keywords.id

If you get more errors, that means that you added search engines to your new profile. Delete them all, including these new ones just added and re-run this step. Or edit the SQL file by hand.

  1. I fired Chrome back up and now my search keywords work fine.
0

I wrote a python script which loads definitions from JSON data. Now you can manage your configuration as code:

https://gist.github.com/ninowalker/9952bf435f8acffa3ef59d6c538ca165

This is idempotent (e.g. can be run multiple times; wont add duplicates by keyword).

Works with python2 and OSX. Can be modified to support other platforms.

0

This is how I do it (I don't remember where I found it).

  1. Create a script export_chrome_search_engines.sh:

    #!/bin/sh
    
    DESTINATION=${1:-./keywords.sql}
    TEMP_SQL_SCRIPT=/tmp/sync_chrome_sql_script
    echo "Exporting Chrome keywords to $DESTINATION..."
    cd ~/.config/google-chrome/Default
    echo .output $DESTINATION > $TEMP_SQL_SCRIPT
    echo .dump keywords >> $TEMP_SQL_SCRIPT
    sqlite3 -init $TEMP_SQL_SCRIPT Web\ Data .exit
    rm $TEMP_SQL_SCRIPT
    
  2. Create a script import_chrome_search_engines.sh:

    #!/bin/sh
    if ps -x | grep -v grep | grep Google\ Chrome > /dev/null; then
        echo "Close Chrome and try again..."
        exit 1
    fi
    
    SOURCE=${1:-./keywords.sql}
    #SOURCE=$1
    TEMP_SQL_SCRIPT=/tmp/sync_chrome_sql_script
    echo
    echo "Importing Chrome keywords from $SOURCE..."
    cd ~/.config/google-chrome/Default
    echo DROP TABLE IF EXISTS keywords\; > $TEMP_SQL_SCRIPT
    echo .read $SOURCE >> $TEMP_SQL_SCRIPT
    sqlite3 -init $TEMP_SQL_SCRIPT Web\ Data .exit
    rm $TEMP_SQL_SCRIPT
    
  3. Make them executable:

    chmod +x export_chrome_search_engines.sh import_chrome_search_engines.sh 
    
  4. To export, shut down Chrome and run:

    ./export_chrome_search_engines.sh
    cp ~/.config/google-chrome/Default/keywords.sql /tmp/
    
  5. To import, shut down Chrome and run:

    cp /tmp/keywords.sql  ~/.config/google-chrome/Default
    ./import_chrome_search_engines.sh
    
-2

As of now, no you cannot. However, you can share bookmarks with your colleagues.

Link to Google Bookmark sharing as of now, Google App users are not able to share bookmarks, or lists of bookmarks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.