SD Card is not saving data

The code below is the one I am using, it uses sdFat. The wiring is correct because it did not have any problems initializing it.

#include <Wire.h>
#include <Adafruit_INA219.h>
#include <Adafruit_SSD1306.h>
#include <SPI.h>
#include “SdFat.h”
SdFat SD;

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
Adafruit_INA219 ina219;

unsigned long previousMillis = 0;
unsigned long interval = 100;
const int chipSelect = 10;
float shuntvoltage = 0;
float busvoltage = 0;
float current_mA = 0;
float loadvoltage = 0;
float energy = 0;
File TimeFile;
File VoltFile;
File CurFile;

void setup() {
SD.begin(chipSelect);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
ina219.begin();
}

void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval)
{
previousMillis = currentMillis;
ina219values();

TimeFile = SD.open(“TIME.txt”, FILE_WRITE);
if (TimeFile) {
TimeFile.println(currentMillis);
TimeFile.close();
}

VoltFile = SD.open(“VOLT.txt”, FILE_WRITE);
if (VoltFile) {
VoltFile.println(loadvoltage);
VoltFile.close();
}

CurFile = SD.open(“CUR.txt”, FILE_WRITE);
if (CurFile) {
CurFile.println(current_mA);
CurFile.close();
}
displaydata();
}
}

void displaydata() {
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.println(loadvoltage);
display.setCursor(35, 0);
display.println(“V”);
display.setCursor(50, 0);
display.println(current_mA);
display.setCursor(95, 0);
display.println(“mA”);
display.setCursor(0, 10);
display.println(loadvoltage * current_mA);
display.setCursor(65, 10);
display.println(“mW”);
display.setCursor(0, 20);
display.println(energy);
display.setCursor(65, 20);
display.println(“mWh”);
display.display();
}

void ina219values() {
shuntvoltage = ina219.getShuntVoltage_mV();
busvoltage = ina219.getBusVoltage_V();
current_mA = ina219.getCurrent_mA();
loadvoltage = busvoltage + (shuntvoltage / 1000);
energy = energy + loadvoltage * current_mA / 3600;
}

Read the instructions for posting queries, at the very least you code should be between [ code] and [ /code].

Is it even opening the files? As a first step I would put a serial println statement in along side the file println statment to check and see whether anything appears on your serial window.

Also post up the code you use to initialise the SD card.

(deleted)