Step 1: Create/Import Spreadsheet in Google Sheets
- Open your web browser and navigate to Google Sheets (sheets.google.com).
- Click on the “+ New” button and select “Google Sheets” to create a new blank spreadsheet.
Step 2: Write a Custom Function in the Script Editor
- Access Script Editor: In your Google Sheets, go to “Extensions” > “Apps Script” to open the Script Editor. And Write the script.
- Get the script from this document: https://docs.google.com/document/d/1HlpWKmNu0YYGLj1HxCbJaolGWz7eFImWBYJ9anQeDEg/edit
Step 3: Test Your Function in the Spreadsheet
- Enter URLs: In your spreadsheet, enter the website URLs you want to check in the “Website URL” column.
- In the cell next to the first URL, type =getStatusCode(A2)
- Press Enter. The cell will display the corresponding status code.