A plugin for creating
.csvfiles, modifying their data, saving them, and performing various CSV-related operations.
This plugin is built with the assumption that you are using DataviewJS. The main purpose of this plugin is to create CSV files and add data to them.


const CSVPlugin = app.plugins.plugins['CSV-allinone'];
const fileName = "HouseKeeping/t/2025-01.csv";
CSVPlugin.readCSV(app, fileName).then(res => {
let headers = []
let defaultValues = {}
for(const [key, value] of Object.entries(res.headers)) {
headers.push(key)
defaultValues[key] = ""
}
const columnLength = headers.length;
let rows = []
for(const row of res.rows) {
const newRow = [row[0].slice(5), ...row.slice(1)]
rows.push(newRow);
}
dv.table(headers, rows);
})

This feature uses the Buttons plugin.
Feature Description
Source Code
const CSVPlugin = app.plugins.plugins['CSV-allinone'];
const { createButton } = app.plugins.plugins["buttons"];
const fileName = "HouseKeeping/t/2025-01.csv";
const openCSVAppendModal = async(app, headers, f, defaults) => {
CSVPlugin.openCSVInputModal(app, headers, f, defaults)
}
CSVPlugin.readCSV(app, fileName).then(res => {
let headers = []
let defaultValues = {}
for(const [key, value] of Object.entries(res.headers)) {
headers.push(key)
defaultValues[key] = ""
}
const columnLength = headers.length;
let rows = []
for(const row of res.rows) {
const newRow = [row[0].slice(5), ...row.slice(1)]
rows.push(newRow);
}
dv.table(headers, rows);
// default values
defaultValues['Date'] = moment(Date.now()).format('YYYY-MM-DD');
defaultValues['Category'] = res.headers['Category'].options[0];
defaultValues['Description'] = '-' ;
dv.span(
createButton({
app, el: this.container,
args: {
name: "open CSV input modal",
class: ""
},
clickOverride: {
click: openCSVAppendModal,
params: [app, res.headers, fileName, defaultValues]
}
})
)
})

readCSV
Takes a filename and returns the corresponding CSVTable.
saveCSV
Saves the CSVTable data into the given file.
-- Functions available within the class will be documented here.
When you create a CSV file using this plugin, two files are generated: .csv and .csv.meta.
If you load an existing CSV file, a .csv.meta file is generated automatically.
The CSV file contains basic table data, while the .meta file contains information about each column's attributes.
Currently (v0.1.0), the .meta file only stores column types, but in the future, it will include additional data, such as select values or validity checks.
Feel free to contribute however you'd like. Contributions are always welcome!