How to Connect Excel Power Query to a Website with Two-Factor Authentication (2FA)
Question details
The user wants to know if Excel Power Query can connect to web services that require two-factor authentication (2FA), and how to configure the connection.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Pulling data from a secure web service or application like Business Central using Power Query.
- Observed behavior
- Needs to authenticate securely via 2FA, import the web data into Excel, and understand how 2FA affects data refresh capabilities.
Ensure you have the exact web service URL or API endpoint ready, and keep your mobile device or authenticator app nearby to approve the two-factor authentication prompt during the initial sign-in.
Connect and Authenticate via 'From Web' in Excel
Use Excel's built-in web connection tool to access the service, choosing the appropriate authentication method (like OAuth or Web API) to trigger the 2FA prompt.
Power Query can successfully connect to web platforms protected by two-factor authentication (2FA), provided the web service supports modern authentication flows like OAuth. The connection process involves an interactive sign-in where you approve the login just as you would in a web browser.
Open your Excel workbook, navigate to the 'Data' tab on the top ribbon, click on 'Get Data', select 'From Other Sources', and then click 'From Web'.
In the dialog box that appears, paste the URL of the web service, API endpoint, or Business Central environment you wish to connect to, and click 'OK'.
A new window will prompt you for credentials. Select the authentication method required by your provider (often 'Organizational account' or 'Web API' for corporate services).
Click 'Sign In'. A browser-like popup will appear. Enter your username and password, then approve the two-factor authentication request on your phone or authenticator app.
Once authenticated, click 'Connect'. The Power Query Navigator will open, allowing you to select the specific tables you need, transform the data, and load it into your spreadsheet.

Try WPS Office for Seamless Data Management
While advanced API connections with 2FA are specific to Microsoft's Power Query ecosystem, WPS Office provides an incredibly lightweight, free, and highly compatible alternative for your daily spreadsheet and data analysis needs. Enjoy all standard data processing tools without expensive subscriptions.
- 1. Download and Install: Visit the official WPS Office website to download and install the free software suite on your computer.
- 2. Open WPS Spreadsheet: Launch WPS Office and click on 'Spreadsheet' to create a new blank workbook or open an existing Excel file.
- 3. Import and Analyze Data: Use the 'Data' tab to easily import CSV files, web queries, and text files, then utilize built-in tools to filter and summarize your data.

Frequently Asked Questions
Why does my scheduled Power Query data refresh fail when using two-factor authentication?
Scheduled or unattended data refreshes fail because 2FA inherently requires interactive user input (such as entering a code or tapping an app notification). Since an automated background process cannot physically perform this step, the connection gets blocked.
Can I bypass two-factor authentication for automated Excel refreshes?
You cannot bypass standard 2FA if your organization mandates it. However, you can ask your IT administrator if they can provide an 'App Password', a Service Principal, or a dedicated API token that is authorized for unattended data extraction without triggering a 2FA prompt.
Does Power Query support Organizational account logins?
Yes. When connecting to supported Microsoft services, Business Central, or SharePoint, you can select 'Organizational account' in the authentication dialog. This natively supports modern authentication flows, including Azure Active Directory 2FA.




