Converting Excel with Macros to Google Spreadsheets

One of my recent project involved converting a finance related Microsoft Excel Spreadsheet into a web based Google Spreadsheet that can be accessed from a web browser. The Excel sheet had VBA Macros that were converted into corresponding functions using Google Apps Scripts.

Here’s one such VBA routine that scraped Yahoo Finance and was rewritten in Google Apps. In Visual Basic, you create an XMLHttpRequest object to connect to an external server which can be replaced with URLFetch in Apps Script. The debug.print methods can be replaced with Logger.log while the regular JavaScript functions can be used for text manipulation.

The StatusBar property of the Application object in Excel VBA displays the macro progress in the Excel UI and you can replace it with the .toast() method of SpreadsheetApp class in Google Scripts.