iTranslated by AI
Creating and Publishing a Spreadsheet Row Highlighter Extension: A Comprehensive Guide
I created and published a browser extension that highlights rows in Google Sheets, so I have summarized what I researched and did up to that point.

This extension is available on the Chrome Web Store and Firefox Add-ons. Please feel free to use it!
Motivation
I wanted a feature to highlight the row of the current cell in Google Sheets, so I looked into how to achieve that.
However, I could only find methods that involve modifying the sheet's content. Since modifying a shared sheet used by others isn't ideal, I decided against that approach.
I thought I might be able to solve this by creating my own extension, so I started looking into it.
About Browser Extensions
Types
Extensions consist of HTML + CSS + JS + images, etc.
There are several types of extensible features:
- "Background Page": Runs in the browser's background.
- "Content Scripts": Accesses and manipulates the content of web pages.
- "Browser Action": Displays a popup when the extension icon is clicked.
- "Page Action": Adds an icon and displays a popup inside the URL bar.
- "Option Page": Displays the settings screen for the extension.
You build an extension by combining the necessary components from these.
For this project, I created it using Content Scripts and Browser Action.
manifest.json
These settings are managed in a file called manifest.json.
The extension's name, description, and the permissions required for execution are also described in this file.
Here is a sample of the content. Detailed information can be found on MDN, so it's a good idea to write the necessary settings from there.
{
"name": "extension sample",
"description": "...",
"version": "0.1",
"manifest_version": 2,
"icons": {
"48": "images/icon48.png",
},
"background": {
"scripts": ["scripts/background.js"],
"page": "pages/background.html"
},
"content_scripts": [
{
"exclude_matches": ["*://developer.mozilla.org/*"],
"matches": ["*://*.mozilla.org/*"],
"js": ["scripts/content.js"]
}
],
"browser_action": {
"default_popup": "pages/popup.html"
},
"permissions": ["storage"],
}
Message passing
When sending and receiving messages between scripts, you use runtime.sendMessage and runtime.onMessage.
Specifically, this is used for purposes such as notifying the Background Page when a button in the popup is clicked.
const button = document.getElementById('button')
button.addEventListener('click', () => {
chrome.runtime.sendMessage({ message: 'test' }, (response) => {
console.log(response.message) // -> ok
})
})
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
console.log(request.message) // -> test
sendResponse({ message: 'ok' })
})
With sendMessage, you can send any object and also receive a response.
WebExtension API
APIs are provided that allow extensions to use browser features (such as tabs and storage).
You can check the list of APIs here.
The APIs you use must be listed in the permissions section of manifest.json.
Internationalization
You can support multiple languages using i18n.
It is available simply by preparing _locales/${language tag}/messages.json and setting the default locale. For the language tag, you can specify en, ja, etc.
After preparing messages.json like the following:
{
"extensionDescription": {
"message": "Description of the extension."
}
}
{
"extensionDescription": {
"message": "拡張機能の説明文です。"
}
}
By specifying the default language tag in default_locale and using __MSG_${message name}__ for values, you can display messages appropriate for the user's environment.
{
...
"default_locale": "en",
"description": "__MSG_extensionDescription__",
...
}
You can also retrieve messages from scripts.
const message = chrome.i18n.getMessage('extensionDescription')
console.log(message)
Testing the Extension
In the Chrome extension list (chrome://extensions/), turn on "Developer mode" and select your working directory from "Load unpacked."
The extension will be added immediately, allowing you to test its functionality.
When reflecting code updates, you need to update the extension from this screen.
Publishing Process
Chrome Web Store
Developer Registration
Register at the Chrome Web Store Developer Console.
You will need to pay a $5 registration fee 💰 to Google.
The only payment method is by credit card.
Item Registration
Once the Developer Dashboard is displayed, upload your extension as a ZIP file using the "New Item" button in the top right.
Entering Information
Register the extension's description, icon images, screenshots, and more.
If you have internationalized the extension, you can enter descriptions for each language.
You also need to fill out the Privacy section,
explaining the purpose of the extension and why it requires certain permissions.
Specifying excessive permissions or execution scopes may delay the review process.
Review
Submit your application using the "Submit for Review" button.
Choose whether to publish automatically after passing the review and send it.
If it is rejected, the reason will be sent via email.
Make the necessary changes and reapply.
Publication
If you choose automatic publishing, it will be published as soon as it passes the review.
When I checked the dashboard, the status had changed to "Published" 🎉
Firefox Add-ons
Firefox extensions are compatible with Chrome, so it seems you can run extensions for Chrome with minimal changes.
In this case, thanks to Firefox's support for chrome.*, I was able to run the extension without changing the code.
I will try applying with the same extension I uploaded to the Chrome Web Store.
Side note:
A polyfill was available to write code in the browser.* format so that it can also run on Chrome.
It seems good to use this when creating extensions for both Chrome and Firefox at the same time. I wanted to try it.
Account Registration
You can register add-ons if you have a Firefox account.
Log in from the "Register or Manage Extensions" link in the top right of the Add-on Developer Hub.
Add-on Registration
Upload the ZIP file just like with Chrome.
Validation starts automatically and checks for issues beforehand.
I was loading a JS library from an external source, but it seems that is not allowed... (It was OK in the Chrome review).
After fixing it so that everything is self-contained locally, it passed the check.
If you are using a bundler or similar, it seems you need to submit the source code.
I'm not using one this time, so I'll proceed as is.
Entering Information
After entering the extension's name and description, the review starts automatically when you "Submit Version."
Following this, you can enter information for each language and register screenshots, just like with Chrome.
Publication
You will be notified via email when it is published.
When I checked the dashboard, it was "Approved" 🎉
Conclusion
Thank you for reading until the end! 🙇
This article summarizes the process from the basics of extensions to publication roughly, but I hope it is helpful.
Development is easy to start, so why not try your hand at making an extension!
Discussion
欲しかった機能です!Spreadsheetの作業効率があがりました。少額ですがサポートいたしました。
サポートありがとうございます!!!
ご要望などあれば、ぜひ連絡ください!
今後も使っていただけると嬉しいです🙏
まさにほしかった機能です、ありがとうございます。
目grepによる眼精疲労がひどかったので、これで少しはよくなりそうです。
カレント行に色がついていても、ちゃんと透過して表示してくださってとても便利です。
心ばかりですがバッジお送りしました、たくさん使わせていただきます。
嬉しいお言葉ありがとうございます!
カーソルのある行を目視で確認するの大変ですよね、、
今後も使って頂けると嬉しいです!
サポートありがとうございました!!
作業がめちゃくちゃ楽になります!
作ってくださりありがとうございます!
使わせていただきます!
コメントありがとうございます!!
使って頂けて嬉しいです!