caspion
caspion copied to clipboard
Add missing fields to GoogleSheets exporter
The purpose is to add the 6 fields that exist in the csv export file (csv.ts), but are missing from this Google Sheets export.
Please note that I used to be a programmer, but in C++, not Java or anything after it.
I have no idea how to test the changes that I propose ... , so this is NOT TESTED.
Hi! Thanks. FIrst - I need to let you know that I'm really not familiar with this development environment; I'm trying to learn on the go, and I'm trying to be careful not to do any harm. Finally I succeeded in setting things up, and I succeeded in testing my code. Unfortunately I got an error. The columns are correctly created in the Google Sheet, but I get an error message in red saying: "Invalid values[3][11]: struct_value { fields { key: "number" value { number_value: 3.0 } } fields { key: "total" value { number_value: 3.0 } } }" I have no idea what to do with that and how to debug it. Sorry. No data at all is written in the sheet (only the columns).
About your comment that the news fields should be at the utmost right, I agree. The reason I did it before the original currency column is because of the comment of @SeanZor: "* Place the Currency field to the most right". I understood that as a requirement that it must always be at the utmost right, but now I understand that I misunderstood it.
Can you guide me how to debug/troubleshoot the changes I did? Thanks, Michel
On Wed, 10 Aug 2022 at 19:58, Baruch Odem (Rothkoff) < @.***> wrote:
@.**** requested changes on this pull request.
Thank you for contributing!!
It is similar to #333 https://github.com/brafdlog/caspion/pull/333 which already merged, so I accept this change.
We just need to think if and how we can notify the user that we have new columns.
In src/backend/export/outputVendors/googleSheets/googleSheets.ts https://github.com/brafdlog/caspion/pull/366#discussion_r942686694:
@@ -11,7 +11,7 @@ import { appendToSpreadsheet } from './googleSheetsInternalAPI';
const GOOGLE_SHEETS_DATE_FORMAT = 'DD/MM/YYYY';
const DEFAULT_SHEET_NAME = '_caspion';
-const COLUMN_HEADERS = ['תאריך', 'סכום', 'תיאור', 'תיאור נוסף', 'קטגוריה', 'מספר חשבון', 'hash - לא לגעת', 'מטבע'];
+const COLUMN_HEADERS = ['תאריך', 'סכום', 'תיאור', 'תיאור נוסף', 'קטגוריה', 'מספר חשבון', 'hash - לא לגעת', 'תאריך חיוב', 'מזהה', 'סטטוס', 'סוג', 'תשלומים', 'סכום מקור', 'מטבע'];
⬇️ Suggested change
-const COLUMN_HEADERS = ['תאריך', 'סכום', 'תיאור', 'תיאור נוסף', 'קטגוריה', 'מספר חשבון', 'hash - לא לגעת', 'תאריך חיוב', 'מזהה', 'סטטוס', 'סוג', 'תשלומים', 'סכום מקור', 'מטבע'];
+const COLUMN_HEADERS = [
'תאריך', 'סכום', 'תיאור', 'תיאור נוסף',
'קטגוריה', 'מספר חשבון', 'hash - לא לגעת',
'תאריך חיוב', 'מזהה', 'סטטוס', 'סוג',
'תשלומים', 'סכום מקור', 'מטבע'
+];
You need to break the line because it is too long.
In src/backend/export/outputVendors/googleSheets/googleSheets.ts https://github.com/brafdlog/caspion/pull/366#discussion_r942691098:
transaction.hash,
moment(transaction.processedDate).format(GOOGLE_SHEETS_DATE_FORMAT),
transaction.identifier,
transaction.status,
transaction.type,
transaction.installments,
transaction.originalAmount,
transaction.originalCurrency
⬇️ Suggested change
transaction.hash,
moment(transaction.processedDate).format(GOOGLE_SHEETS_DATE_FORMAT),
transaction.identifier,
transaction.status,
transaction.type,
transaction.installments,
transaction.originalAmount,
transaction.originalCurrency
transaction.hash,
transaction.originalCurrency,
moment(transaction.processedDate).format(GOOGLE_SHEETS_DATE_FORMAT),
transaction.identifier,
transaction.status,
transaction.type,
transaction.installments,
transaction.originalAmount
I think you need to add new fields to the end (after transaction.originalCurrency).
Imagine an existing sheet, today the last column is originalCurrency. Now you are adding new data, that contains more fields, and the 8th column was originalCurrency and now becomes processedDate.
— Reply to this email directly, view it on GitHub https://github.com/brafdlog/caspion/pull/366#pullrequestreview-1068623818, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2NYV2H4IGVAFJH5ON64FBLVYPNR5ANCNFSM56FEXHDA . You are receiving this because you authored the thread.Message ID: @.***>
Hi, I don't know how you running your code, but you can put the debugger
command inside your code to break the code in that line.
You need the DevTools to be open to the debugger
will work.
Regarding your error, I guess it says the data in line 3 column 11 is not correct. But need to check this.
Hi. In the meantime I solved the problem. It was related to the installment field. I removed this field. I got then a build error because of spaces which I fixed. Do you indeed see my additional version ? What’s next? How/when will my changes make it to the release? Thanks, Michel
From: Baruch Odem (Rothkoff) @.> Sent: Sunday, August 14, 2022 8:54:06 AM To: brafdlog/caspion @.> Cc: michlus @.>; Author @.> Subject: Re: [brafdlog/caspion] Add missing fields to GoogleSheets exporter (PR #366)
Hi, I don't know how you running your code, but you can put the debugger command inside your code to break the code in that line. You need the DevTools to be open to the debugger will work.
Regarding your error, I guess it says the data in line 3 column 11 is not correct. But need to check this.
— Reply to this email directly, view it on GitHubhttps://github.com/brafdlog/caspion/pull/366#issuecomment-1214291010, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2NYV2FREPCQLZPDFVBOOTLVZCCX5ANCNFSM56FEXHDA. You are receiving this because you authored the thread.Message ID: @.***>
I think I will test it in my computer and then we will create a new release.
Perfect. Thank you.
From: Baruch Odem (Rothkoff) @.> Sent: Sunday, August 14, 2022 9:08:14 AM To: brafdlog/caspion @.> Cc: michlus @.>; Author @.> Subject: Re: [brafdlog/caspion] Add missing fields to GoogleSheets exporter (PR #366)
I think I will test it in my computer and then we will create a new release.
— Reply to this email directly, view it on GitHubhttps://github.com/brafdlog/caspion/pull/366#issuecomment-1214292486, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2NYV2EUZ6KUVFIN4QSBGQLVZCEM5ANCNFSM56FEXHDA. You are receiving this because you authored the thread.Message ID: @.***>
I see that a build failed. Seems like a fetching packages issue. I do see however that "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz: " is reachable, at least - without the colon (:)
Thanks @michlus!
:tada: This PR is included in version 0.1.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: