With the increasing integration of battery energy storage systems (BESSs) into the power grid, BESSs are facing growing network threats, especially sequential false data injection attacks (FDIAs). These attacks can compromise BESS measurement data without being detected by the bad data detection (BDD) mechanism, thereby affecting the accuracy of state of charge (SOC) estimation. To enhance the security and stability of gridconnected BESSs, this paper introduces a data-driven defense framework comprising attack detection and data recovery. For the detection of sequential FDIAs, we employ the GPformer algorithm, a method that efficiently extracts temporal and spatial features from measurement data using two enhanced Transformer encoders and a gating mechanism. Following attack detection, the TACN algorithm is utilized for data recovery. This approach combines the temporal convolutional network (TCN) with an attention mechanism to predict future measurement data. By replacing the compromised data with these predictions, the TACN algorithm effectively restores the system to its normal operating state. The proposed defense framework is entirely data-driven and does not rely on specific topological parameters of the system. Simulation experiments conducted on the IEEE 14-bus and IEEE 57-bus systems integrated with BESS demonstrate the effectiveness of the framework. The results indicate that this framework is able to accurately and efficiently detect sequential FDIAs of various intensities with an accuracy rate of over 97 %, while significantly reducing the training time. Furthermore, it facilitates the recovery of attacked data, and the SOC estimation error after data recovery can be maintained within 1 %, thus providing enhanced safety for both BESSs and the power grid.