0

I have a csv file from import business and i try to copy the data of this file in my google sheets. The problem is with the format of the csv file. I try several times and i have an error with NA y use NA FILTER for solve that.But the first column disappeared maybe because maybe it has a NA. That column is critical to me because it has the names of the companies. I'm lost, can you think of any help?

Azulejos = pd.read_csv('IMPORTACIONES-2021-01-01-2021-08-31--6907.23.00.000E (2).csv',sep=";",encoding="latin-1",na_filter= False)

print(Azulejos)

Importador (prob.)     Cuit  ... Código.1 Detalle
CERAMICA MAJA SRL             30707457003  01-2021  ...                 
LEMO BALTASAR BRUM            20925092852  01-2021  ...                 
LEMO BALTASAR BRUM            20925092852  01-2021  ...                 
BALCARCE 54 S.A.              30680857209  01-2021  ...                 
BALCARCE 54 S.A.              30680857209  01-2021  ...                 
...                                   ...      ...  ...      ...     ...
BODEN CERAMICS S.R.L.         30716000385  07-2021  ...                 
BODEN CERAMICS S.R.L.         30716000385  07-2021  ...                 
BODEN CERAMICS S.R.L.         30716000385  07-2021  ...                 
BODEN CERAMICS S.R.L.         30716000385  07-2021  ...                 
BODEN CERAMICS S.R.L.         30716000385  07-2021  ...                 

[574 rows x 59 columns]

Photo from google sheets
[1]: https://i.stack.imgur.com/ToIB9.png



#spreadsheet
gc = gspread.service_account(filename='spreadsheet-323416-3a7c20722874.json')
sh = gc.open_by_key('1vL3R_5Fcvo7MPzXNuaGNYr4yG03ie4VCaCRhZUeQhhU')
worksheet = sh.get_worksheet(0)
worksheet.update([Azulejos.columns.values.tolist()] + Azulejos.values.tolist())
  • You should really post the full traceback of the error along with your question. But let's see: if we're getting an error on `np.nan`, what should we do with that? Do we need to change it to another value? For example, `.fillna("")`? Or do we need to drop rows containing `np.nan`? Using `.dropna()`, perhaps. – mechanical_meat Sep 03 '21 at 15:15
  • thanks for the answer. For examle i need to appear "Boden Ceramics' that is the name from the company. When i copy the data in google this name disaappear. – Julian Ruggiero Sep 03 '21 at 15:21
  • is there actually a need to use pandas? I see nothing in your code that actually *uses* pandas besides loading the CSV file. gspread can import CSV files directly. See [this answer](https://stackoverflow.com/a/57265914/9267296) – Edo Akse Sep 03 '21 at 16:36
  • thanks only have one more question, how i can delimiter de csv file in the answer that you gave me – Julian Ruggiero Sep 03 '21 at 18:16
  • Same as with pandas, `delimiter=";" ` – Edo Akse Sep 04 '21 at 09:45

0 Answers0