The invention belongs to the technical field of file processing, and particularly relates to a method for generating a template file based on online visualization, which comprises template online visualization management and maintenance and dynamic generation of a business file based on the template, and comprises the following specific steps: S1, in the template online visualization management and maintenance, generating a business file based on the template; the method comprises the following steps: firstly, making a template file by a business personnel through a template online visual editor, transferring the template file with high complexity requirement to a developer after file conversion, and carrying out online template secondary processing; and S2, for a relatively complex file generation demand, the method has the beneficial effects that an online template editor is provided through rectification and reformation of various technologies and means, so that business personnel can directly participate in template production, and in the template production process, the business personnel can conveniently and quickly use data indexes to mark data sources, and the efficiency is improved. And the processing template data, business processing and file generation are decoupled, and after integration, an online cooperation mode can be adopted.