This PowerShell script downloads the iShares Bitcoin Trust ETF fund data from the official iShares website and converts it from XML to pandas friendly XLSX format.
- Downloads fund data directly from iShares.com
- Converts XML format to modern XLSX format
- Colored console output for better user experience
- Error handling and cleanup
- Optional parameters for customization
- Windows PowerShell 5.1 or PowerShell Core 6.0+
- Microsoft Excel (for XML to XLSX conversion)
- Internet connection
.\download_ishares_bitcoin_etf.ps1This will download the file and save it as ishares_bitcoin_etf.xlsx in the current directory.
.\download_ishares_bitcoin_etf.ps1 -OutputPath "C:\Data\bitcoin_etf_data.xlsx".\download_ishares_bitcoin_etf.ps1 -Force.\download_ishares_bitcoin_etf.ps1 -OutputPath "C:\Data\bitcoin_etf_data.xlsx" -Force-OutputPath: Specifies the output file path (default:.\ishares_bitcoin_etf.xlsx)-Force: Forces overwrite of existing files without prompting
-
Downloads the iShares Bitcoin Trust ETF fund data from:
https://www.ishares.com/us/products/333011/fund/1521942788811.ajax?fileType=xls&fileName=iShares-Bitcoin-Trust-ETF_fund&dataType=fund -
Converts the downloaded XLS file to XLSX format using Excel COM automation
-
Cleans up temporary files automatically
-
Provides detailed progress information with colored output
The script includes comprehensive error handling for:
- Network connectivity issues
- File download failures
- Excel availability checks
- File conversion errors
- Permission issues
- Success: Creates an XLSX file with the fund data
- Failure: Provides detailed error messages and cleanup
If Excel is not installed or accessible, the script will:
- Download the XLS file to a temporary location
- Inform you where the file is located
- Suggest manual conversion
Run PowerShell as Administrator if you encounter permission errors.
If you get execution policy errors, run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserThe downloaded file contains iShares Bitcoin Trust ETF fund data including:
- Fund performance metrics
- Holdings information
- Risk statistics
- Other fund-related data
- The script uses a standard User-Agent header for web requests
- Temporary files are automatically cleaned up
- No sensitive data is logged or stored
This script was designed with help from Cursor/Claude Sonnet and is designed for Windows PowerShell environments.