Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to overwrite existing CSV file with the same name in target Drive folder #211

Open
ttsukagoshi opened this issue Aug 23, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ttsukagoshi
Copy link
Owner

ttsukagoshi commented Aug 23, 2024

Add an option updateExistingCsvFiles to overwrite or replace existing CSV files with the same name in the target Drive folder when a new CSV file with the same name is to be uploaded.

Implementing this new feature would require using the files.update method of the Drive API and an additional process to check the contents of the existing csv folder to see whether a particular CSV file already exists in the target Drive folder.

See: Method: files.update  |  Google Drive  |  Google for Developers

Some background

When saveOriginalFilesToDrive is set to true in the c2g.config.json config file, the original CSV file is uploaded to the child folder named csv under the target Google Drive folder.

In the current settings, CSV files in the csv are newly created (uploaded) on every run REGARDLESS of the existence of CSV files with the same name. So if you are using csv2gsheets in a situation where you have a batch process to convert & upload CSV files with unchanging file names, you would be creating a new CSV file with the same file name as previous runs every time you run the command. The only way to distinguish between such CSV files will be to look at their Created at date-time values.

On the other hand, some users might expect the CSV files uploaded to the Drive folder to be REPLACED with the newer version instead of creating a new one when a CSV file with the same name already exists, especially if they have set updateExistingGoogleSheets, i.e., the option to update existing Google Sheets files with the same name, to true.

When adding this new option, updateExistingCsvFiles, we should set the default value to false for backward compatibility.

@ttsukagoshi ttsukagoshi added the enhancement New feature or request label Aug 23, 2024
@ttsukagoshi ttsukagoshi self-assigned this Aug 23, 2024
@ttsukagoshi ttsukagoshi added this to the v2 milestone Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant