From b45a6c490a292b6caff9078fed3d6642fc162bd8 Mon Sep 17 00:00:00 2001 From: Bobby Abellana Date: Mon, 24 Feb 2025 14:47:52 -0800 Subject: [PATCH] Created README.md --- README.md | 85 +++++++++++++++++++++++++++++++++++++++++ SharePointFunctions.ps1 | 4 +- 2 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0f868ef --- /dev/null +++ b/README.md @@ -0,0 +1,85 @@ +# SharePoint XLS to XLSX Converter + +This tool allows you to convert legacy `.xls` files stored in SharePoint to the modern `.xlsx` format. The converter maintains the original folder structure and automatically uploads the converted files back to SharePoint. + +## Installation Instructions + +### Step 1: Install PowerShell 7.5 + +1. Visit the [PowerShell GitHub releases page](https://github.com/PowerShell/PowerShell/releases) +2. Download the appropriate installer for your system (e.g., `PowerShell-7.5.0-win-x64.msi` for 64-bit Windows) +3. Run the installer and follow the on-screen instructions +4. Verify the installation by opening PowerShell 7 from the Start menu + +### Step 2: Install Required Dependencies + +1. Download the XLS to XLSX Converter files to a folder on your computer +2. Right-click on PowerShell 7 in the Start menu and select "Run as administrator" +3. Navigate to the folder containing the converter files: + ``` + cd C:\path\to\XLS_to_XLSX + ``` +4. Run the dependency installer script: + ``` + .\Install-Dependencies.ps1 + ``` +5. The script will install the required Microsoft Graph modules and verify that Excel is installed + +### Step 3: Configure Microsoft Graph Authentication + +1. The first time you run the application, you'll need to authenticate with Microsoft Graph +2. Follow the prompts to sign in with your Microsoft 365 account that has access to the SharePoint site + +## Operating the Program + +### Starting the Application + +1. Open PowerShell 7 as administrator +2. Navigate to the application folder: + ``` + cd C:\path\to\XLS_to_XLSX + ``` +3. Run the application in STA mode: + ``` + pwsh -STA -File .\MainForm.ps1 + ``` + +### Using the Application + +1. **Configure SharePoint Settings**: + - Enter your SharePoint site URL (e.g., `https://yourcompany.sharepoint.com/sites/yoursite`) + - Enter the document library name (e.g., `Shared Documents` or `Documents`) + - Click "Save Config" to save these settings for future use + +2. **Connect to SharePoint**: + - Click the "Connect" button to authenticate with SharePoint + - Follow any authentication prompts that appear + +3. **Select a Folder** (Optional): + - Click "Browse" to navigate to a specific folder in SharePoint + - If no folder is selected, the application will work with files in the root of the document library + +4. **List XLS Files**: + - Click "List XLS Files" to find all `.xls` files in the selected location + - The files will be displayed in the grid at the bottom of the window + +5. **Convert Files**: + - Click "Convert to XLSX" to begin the conversion process + - The application will: + - Download each `.xls` file + - Convert it to `.xlsx` format using Excel + - Upload the converted file back to the same location in SharePoint + - Progress and status messages will appear in the text box on the right + +## Troubleshooting + +- **Authentication Issues**: Ensure you have the correct permissions to access the SharePoint site +- **Excel Errors**: Make sure Microsoft Excel is installed and properly licensed +- **File Access Errors**: Check that you have permission to read and write to the SharePoint libraries +- **Conversion Failures**: Some very old or complex Excel files may not convert properly + +## Notes + +- The application requires an active internet connection +- Large files may take longer to download, convert, and upload +- The original `.xls` files remain unchanged in SharePoint \ No newline at end of file diff --git a/SharePointFunctions.ps1 b/SharePointFunctions.ps1 index 87f67a2..8fdcf9e 100644 --- a/SharePointFunctions.ps1 +++ b/SharePointFunctions.ps1 @@ -318,8 +318,8 @@ function Get-XlsFilesCurrentFolder { foreach ($item in $items) { $script:txtStatus.Text += "Checking item: $($item.Name)`n" - # If it's an Excel file, add it to the list - if ($item.Name -like "*.xls" -or $item.Name -like "*.xlsx" -or $item.Name -like "*.xlsm") { + # If it's an Excel file, add it to the list - only .xls files, not .xlsx + if ($item.Name -like "*.xls" -and -not ($item.Name -like "*.xlsx")) { $script:txtStatus.Text += "Found XLS file: $($item.Name)`n" $allFiles += [PSCustomObject]@{ OriginalPath = $item.WebUrl