Forum Discussion
Excel Online: replacement for VBA macros...
- May 24, 2023
Let's explore the options you mentioned:
- Scripting: In Excel Online, you can use the built-in scripting capabilities provided by Microsoft. Scripting allows you to automate repetitive tasks and perform custom operations on your Excel data. It provides a set of JavaScript-based APIs that you can use to manipulate the Excel workbook, worksheets, ranges, and more. With scripting, you can automate tasks, create custom functions, and build interactive user interfaces within the Excel Online environment.
- JavaScript: JavaScript is a widely used programming language and can be used in combination with Excel Online to automate tasks and enhance functionality. You can use JavaScript to interact with the Excel Online APIs and perform operations such as reading and writing data, formatting cells, creating charts, and more. JavaScript offers flexibility and compatibility across different platforms, making it a good choice for extending Excel Online's capabilities.
- Python: Although Python is not directly integrated into Excel Online, you can leverage it in conjunction with other tools to automate Excel-related tasks. For example, you can use libraries such as pandas and openpyxl to read and write Excel files, perform data analysis, and generate reports. Python offers a wide range of libraries and a large community, making it a popular choice for data manipulation and analysis tasks.
- VBA: Although you can't create, run, or edit VBA (Visual Basic for Applications) macros in Excel for the web, you can open and edit a workbook that contains macros. Any existing macros will remain in the workbook, and you can open the workbook in the Excel desktop app to view and edit the macros.
Ultimately, the choice between scripting with JavaScript or using Python or VBA depends on the specific requirements of your macros and the level of integration needed with Excel Online.
Whatever the choice of torment is yours :).
NikolinoDE I want to do web scrapping using vba macro which version of selenium use with chrome it’s not working properly with me can u please guide
If you're looking to perform web scraping using VBA macro, you can indeed use Selenium with VBA to automate interactions with a web browser such as Chrome. Here's a general guide on how to set it up:
- Download SeleniumBasic: First, you'll need to download and install SeleniumBasic, which is a set of bindings to use Selenium with VBA. You can find the latest release on GitHub: FlorentBreheret/SeleniumBasic.
- Install ChromeDriver: ChromeDriver is a separate executable that WebDriver uses to control Chrome. Make sure you download the correct version of ChromeDriver that matches your Chrome browser version. You can download ChromeDriver from the official site: ChromeDriver - WebDriver for Chrome.
- Reference Selenium Library: In the VBA editor of Excel, go to Tools > References, then browse to the SeleniumBasic.dll file that you downloaded and add it as a reference.
- Write VBA Code: Now you can write your VBA code to automate Chrome using Selenium. Here's a simple example to open Chrome, navigate to a webpage, and extract some information:
Vba code is untested, please backup your file.
Sub WebScrapingWithSelenium()
Dim bot As New WebDriver
bot.Start "chrome" ' You can also use "firefox" or "edge"
bot.Get "https://example.com"
' Find elements and interact with them
Dim element As WebElement
Set element = bot.FindElementById("some_element_id")
Debug.Print element.Text
' Perform other actions as needed
' Quit the browser when done
bot.Quit
End Sub
Make sure to replace "https://example.com" with the URL of the webpage you want to scrape, and "some_element_id" with the ID of the HTML element you want to interact with or extract data from.
5. Run the Macro: Run the WebScrapingWithSelenium macro from Excel, and it should automate Chrome to perform the actions specified in your VBA code.
By following these steps and customizing the VBA code to suit your specific scraping needs, you should be able to perform web scraping using Selenium with VBA in Excel.
NOTE: My knowledge of this topic is limited. The text and the steps are the result of various AI's. Maybe it will help you further in your project, if not please just ignore it.
- kartikeya_sharmaApr 10, 2024Copper Contributor
NikolinoDE thanks a ton pal i will get back to you after performing this right now im out for a fortnight can i also hv your personal email id