EHRFlow is a large language model-driven platform that simplifies electronic health record (EHR) data analysis for physicians through natural language interactions, eliminating the need for complex coding. EHRFlow integrates four key agents: PlanAgent, ToolAgent, CodeAgent, and ReviewAgent in a dual-loop mechanism that efficiently decomposes and executes tasks via PlanAgent, from coarse-grained conceptual planning to fine-grained task execution, leveraging a healthcare tool bank and the code generation and execution capabilities of ToolAgent and CodeAgent. The ReviewAgent ensures the safety and quality of code through iterative feedback and refinement. EHRFlow offers a user-friendly solution for physicians' customized needs while preserving sensitive data’s privacy by executing code operations locally. Demonstrated through case studies, EHRFlow showcases its ability to coordinate agents in resolving complex medical data analysis tasks, highlighting its flexibility, scalability, and efficiency. The code for EHRFlow is publicly released at https://github.com/PKU-AICare/EHRFlow.